"Remove namespace pollution" << ENDL

Removes all "using namespace epee;" and "using namespace std;" from the
code and fixes up the various crappy places where unnamespaced types
were being used.

Also removes the ENDL macro (which was defined to be `std::endl`)
because it is retarded, and because even using std::endl instead of a
plain "\n" is usually a mistake (`<< std::endl` is equivalent to `<<
"\n" << std::flush`, and that explicit flush is rarely desirable).
This commit is contained in:
Jason Rhinelander 2020-04-03 13:30:11 -03:00
parent 51b247bfac
commit 52838aa5b2
43 changed files with 215 additions and 253 deletions

View File

@ -148,8 +148,6 @@ namespace debug
#define ENDL std::endl
#define TRY_ENTRY() try {
#define CATCH_ENTRY(location, return_val) } \
catch(const std::exception& ex) \

View File

@ -62,7 +62,7 @@
else if((query_info.m_URI == s_pattern) && (cond)) \
{ \
handled = true; \
uint64_t ticks = misc_utils::get_tick_count(); \
uint64_t ticks = epee::misc_utils::get_tick_count(); \
command_type::request req{}; \
bool parse_res = epee::serialization::load_t_from_json(req, query_info.m_body); \
CHECK_AND_ASSERT_MES(parse_res, false, "Failed to parse json: \r\n" << query_info.m_body); \
@ -90,11 +90,11 @@
else if(query_info.m_URI == s_pattern) \
{ \
handled = true; \
uint64_t ticks = misc_utils::get_tick_count(); \
uint64_t ticks = epee::misc_utils::get_tick_count(); \
command_type::request req{}; \
bool parse_res = epee::serialization::load_t_from_binary(req, epee::strspan<uint8_t>(query_info.m_body)); \
CHECK_AND_ASSERT_MES(parse_res, false, "Failed to parse bin body data, body size=" << query_info.m_body.size()); \
uint64_t ticks1 = misc_utils::get_tick_count(); \
uint64_t ticks1 = epee::misc_utils::get_tick_count(); \
command_type::response resp{};\
MINFO(m_conn_context << "calling " << s_pattern); \
if(!callback_f(req, resp, &m_conn_context)) \
@ -104,7 +104,7 @@
response_info.m_response_comment = "Internal Server Error"; \
return true; \
} \
uint64_t ticks2 = misc_utils::get_tick_count(); \
uint64_t ticks2 = epee::misc_utils::get_tick_count(); \
epee::serialization::store_t_to_binary(resp, response_info.m_body); \
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
response_info.m_mime_tipe = " application/octet-stream"; \

2
external/loki-mq vendored

@ -1 +1 @@
Subproject commit fc1ea66599b066ec48b59854d59fdaf6fd29d4d0
Subproject commit 3a0508fdce910bd7e424ec25c7f28607db00f611

@ -1 +1 @@
Subproject commit 31a0073c62738827b48d725facd3766879429124
Subproject commit cb238cb1f134accc4200217d9511115a8f61c6cb

View File

@ -394,23 +394,15 @@ void BlockchainDB::reset_stats()
void BlockchainDB::show_stats()
{
LOG_PRINT_L1(ENDL
<< "*********************************"
<< ENDL
<< "num_calls: " << num_calls
<< ENDL
<< "time_blk_hash: " << time_blk_hash << "ms"
<< ENDL
<< "time_tx_exists: " << time_tx_exists << "ms"
<< ENDL
<< "time_add_block1: " << time_add_block1 << "ms"
<< ENDL
<< "time_add_transaction: " << time_add_transaction << "ms"
<< ENDL
<< "time_commit1: " << time_commit1 << "ms"
<< ENDL
<< "*********************************"
<< ENDL
LOG_PRINT_L1("\n"
<< "*********************************\n"
<< "num_calls: " << num_calls << "\n"
<< "time_blk_hash: " << time_blk_hash << "ms\n"
<< "time_tx_exists: " << time_tx_exists << "ms\n"
<< "time_add_block1: " << time_add_block1 << "ms\n"
<< "time_add_transaction: " << time_add_transaction << "ms\n"
<< "time_commit1: " << time_commit1 << "ms\n"
<< "*********************************\n"
);
}

View File

@ -51,7 +51,6 @@
#define LOKI_DEFAULT_LOG_CATEGORY "bcutil"
namespace po = boost::program_options;
using namespace epee;
using namespace cryptonote;
static bool stop_requested = false;
@ -401,7 +400,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}

View File

@ -51,7 +51,6 @@
#define LOKI_DEFAULT_LOG_CATEGORY "bcutil"
namespace po = boost::program_options;
using namespace epee;
using namespace cryptonote;
static const char zerokey[8] = {0};
@ -1133,7 +1132,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}

View File

@ -40,7 +40,6 @@
#define LOKI_DEFAULT_LOG_CATEGORY "bcutil"
namespace po = boost::program_options;
using namespace epee;
using namespace cryptonote;
int main(int argc, char* argv[])
@ -98,7 +97,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}

View File

@ -39,7 +39,6 @@
#define LOKI_DEFAULT_LOG_CATEGORY "bcutil"
namespace po = boost::program_options;
using namespace epee;
int main(int argc, char* argv[])
{
@ -99,7 +98,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}

View File

@ -79,7 +79,6 @@ std::string refresh_string = "\r \r";
namespace po = boost::program_options;
using namespace cryptonote;
using namespace epee;
// db_mode: safe, fast, fastest
int get_db_flags_from_mode(const std::string& db_mode)
@ -107,7 +106,7 @@ int parse_db_arguments(const std::string& db_arg_str, std::string& db_type, int&
}
else if (db_args.size() > 2)
{
std::cerr << "unrecognized database argument format: " << db_arg_str << ENDL;
std::cerr << "unrecognized database argument format: " << db_arg_str << std::endl;
return 1;
}
@ -273,9 +272,7 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
return false;
}
std::cout << ENDL;
std::cout << "Preparing to read blocks..." << ENDL;
std::cout << ENDL;
std::cout << "\nPreparing to read blocks...\n\n";
std::ifstream import_file;
import_file.open(import_file_path, std::ios_base::binary | std::ifstream::in);
@ -315,7 +312,7 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
bool use_batch = opt_batch && !opt_verify;
MINFO("Reading blockchain from bootstrap file...");
std::cout << ENDL;
std::cout << "\n";
std::vector<block_complete_entry> blocks;
@ -399,8 +396,7 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
{
std::cout << refresh_string << "block " << h-1
<< " / " << block_stop
<< "\r" << std::flush;
std::cout << ENDL << ENDL;
<< "\n" << std::endl;
MINFO("Specified block number reached - stopping. block: " << h-1 << " total blocks: " << h);
quit = 1;
break;
@ -429,7 +425,7 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
MDEBUG("loading block number " << h-1);
}
b = bp.block;
MDEBUG("block prev_id: " << b.prev_id << ENDL);
MDEBUG("block prev_id: " << b.prev_id << "\n");
if ((h-1) % progress_interval == 0)
{
@ -507,13 +503,13 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
bool q2;
std::cout << refresh_string;
// zero-based height
std::cout << ENDL << "[- batch commit at height " << h-1 << " -]" << ENDL;
std::cout << "\n[- batch commit at height " << h-1 << " -]\n";
core.get_blockchain_storage().get_db().batch_stop();
pos = import_file.tellg();
bytes = bootstrap.count_bytes(import_file, db_batch_size, h2, q2);
import_file.seekg(pos);
core.get_blockchain_storage().get_db().batch_start(db_batch_size, bytes);
std::cout << ENDL;
std::cout << "\n";
core.get_blockchain_storage().get_db().show_stats();
}
}
@ -558,7 +554,7 @@ quitting:
// TODO: if there was an error, the last added block is probably at zero-based height h-2
MINFO("Finished at block: " << h-1 << " total blocks: " << h);
std::cout << ENDL;
std::cout << "\n";
return 0;
}
@ -651,19 +647,19 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}
if (! opt_batch && !command_line::is_arg_defaulted(vm, arg_batch_size))
{
std::cerr << "Error: batch-size set, but batch option not enabled" << ENDL;
std::cerr << "Error: batch-size set, but batch option not enabled\n";
return 1;
}
if (! db_batch_size)
{
std::cerr << "Error: batch-size must be > 0" << ENDL;
std::cerr << "Error: batch-size must be > 0\n";
return 1;
}
if (opt_verify && command_line::is_arg_defaulted(vm, arg_batch_size))
@ -683,7 +679,7 @@ int main(int argc, char* argv[])
opt_stagenet = command_line::get_arg(vm, cryptonote::arg_stagenet_on);
if (opt_testnet && opt_stagenet)
{
std::cerr << "Error: Can't specify more than one of --testnet and --stagenet" << ENDL;
std::cerr << "Error: Can't specify more than one of --testnet and --stagenet\n";
return 1;
}
m_config_folder = command_line::get_arg(vm, cryptonote::arg_data_dir);
@ -720,7 +716,7 @@ int main(int argc, char* argv[])
res = parse_db_arguments(db_arg_str, db_type, db_flags);
if (res)
{
std::cerr << "Error parsing database argument(s)" << ENDL;
std::cerr << "Error parsing database argument(s)\n";
return 1;
}
@ -773,7 +769,7 @@ int main(int argc, char* argv[])
#endif
if (!core.init(vm, nullptr, get_checkpoints))
{
std::cerr << "Failed to initialize core" << ENDL;
std::cerr << "Failed to initialize core\n";
return 1;
}
core.get_blockchain_storage().get_db().set_batch_transactions(true);
@ -815,7 +811,7 @@ int main(int argc, char* argv[])
}
catch (const DB_ERROR& e)
{
std::cout << std::string("Error loading blockchain db: ") + e.what() + " -- shutting down now" << ENDL;
std::cout << std::string("Error loading blockchain db: ") + e.what() + " -- shutting down now\n";
core.deinit();
return 1;
}

View File

@ -45,7 +45,6 @@
#define MDB_val_set(var, val) MDB_val var = {sizeof(val), (void *)&val}
namespace po = boost::program_options;
using namespace epee;
using namespace cryptonote;
static std::string db_path;
@ -493,7 +492,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}

View File

@ -43,7 +43,6 @@
#define LOKI_DEFAULT_LOG_CATEGORY "bcutil"
namespace po = boost::program_options;
using namespace epee;
using namespace cryptonote;
static std::map<uint64_t, uint64_t> load_outputs(const std::string &filename)
@ -152,7 +151,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}

View File

@ -40,7 +40,6 @@
#define LOKI_DEFAULT_LOG_CATEGORY "bcutil"
namespace po = boost::program_options;
using namespace epee;
using namespace cryptonote;
static bool stop_requested = false;
@ -108,7 +107,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}
@ -193,7 +192,7 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
*/
// spit out a comment that GnuPlot can use as an index
std::cout << ENDL << "# DATA" << ENDL;
std::cout << "\n# DATA\n";
std::cout << "Date\tBlocks/day\tBlocks\tTxs/Day\tTxs\tBytes/Day\tBytes";
if (do_inputs)
std::cout << "\tInMin\tInMax\tInAvg";
@ -209,7 +208,7 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
std::cout << buf;
}
}
std::cout << ENDL;
std::cout << "\n";
struct tm prevtm = {0}, currtm;
uint64_t prevsz = 0, currsz = 0;
@ -272,7 +271,7 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
txhr[i] = 0;
}
}
std::cout << ENDL;
std::cout << "\n";
}
skip:
currsz += bd.size();

View File

@ -41,7 +41,6 @@
#define LOKI_DEFAULT_LOG_CATEGORY "bcutil"
namespace po = boost::program_options;
using namespace epee;
using namespace cryptonote;
struct output_data
@ -131,7 +130,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}

View File

@ -35,7 +35,6 @@
namespace po = boost::program_options;
using namespace cryptonote;
using namespace epee;
namespace
{
@ -166,7 +165,7 @@ bool BlocksdatFile::store_blockchain_raw(Blockchain* _blockchain_storage, tx_mem
}
// print message for last block, which may not have been printed yet due to progress_interval
std::cout << refresh_string;
std::cout << "block " << m_cur_height-1 << "/" << block_stop << ENDL;
std::cout << "block " << m_cur_height-1 << "/" << block_stop << "\n";
MINFO("Number of blocks exported: " << num_blocks_written);

View File

@ -39,7 +39,6 @@
namespace po = boost::program_options;
using namespace cryptonote;
using namespace epee;
namespace
{
@ -315,7 +314,7 @@ bool BootstrapFile::store_blockchain_raw(Blockchain* _blockchain_storage, tx_mem
}
// print message for last block, which may not have been printed yet due to progress_interval
std::cout << refresh_string;
std::cout << "block " << m_cur_height-1 << "/" << block_stop << ENDL;
std::cout << "block " << m_cur_height-1 << "/" << block_stop << "\n";
MINFO("Number of blocks exported: " << num_blocks_written);
if (num_blocks_written > 0)
@ -489,13 +488,12 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path, std::s
import_file.close();
std::cout << ENDL;
std::cout << "Done scanning bootstrap file" << ENDL;
std::cout << "Full header length: " << full_header_size << " bytes" << ENDL;
std::cout << "Scanned for blocks: " << bytes_read << " bytes" << ENDL;
std::cout << "Total: " << full_header_size + bytes_read << " bytes" << ENDL;
std::cout << "Number of blocks: " << h << ENDL;
std::cout << ENDL;
std::cout << "\nDone scanning bootstrap file";
std::cout << "\nFull header length: " << full_header_size << " bytes";
std::cout << "\nScanned for blocks: " << bytes_read << " bytes";
std::cout << "\nTotal: " << full_header_size + bytes_read << " bytes";
std::cout << "\nNumber of blocks: " << h;
std::cout << std::endl;
// NOTE: h is the number of blocks.
// Note that a block's stored height is zero-based, but parts of the code use

View File

@ -41,8 +41,6 @@
#include "blockchain_db/blockchain_db.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
using namespace epee;
#include "common/loki_integration_test_hooks.h"
#include "common/loki.h"

View File

@ -38,7 +38,6 @@
#include <boost/thread/mutex.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/optional.hpp>
using namespace epee;
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "net.dns"

View File

@ -28,4 +28,20 @@ bool string_iequal_any(const S1& s1, const S2& s2, const S&... s) {
}
#endif
/// Returns a string_view that views the data of the given object; this is not something you want to
/// do unless the struct is specifically design to be used this way. The value must be a standard
/// layout type; it should really require is_trivial, too, but we have classes (like crypto keys)
/// that aren't C++-trivial but are still designed to be accessed this way.
template <typename T>
lokimq::string_view view_guts(const T& val) {
static_assert(std::is_standard_layout<T>(), "cannot safely access non-trivial class as string_view");
return {reinterpret_cast<const char *>(&val), sizeof(val)};
}
/// Convenience wrapper around the above that also copies the result into a new string
template <typename T>
std::string copy_guts(const T& val) {
return std::string{view_guts(val)};
}
}

View File

@ -60,8 +60,6 @@
#include "file_io_utils.h"
#include "wipeable_string.h"
#include "misc_os_dependent.h"
using namespace epee;
#include "crypto/crypto.h"
#include "util.h"
#include "stack_trace.h"
@ -775,7 +773,7 @@ namespace tools
return "<unknown>";
time_t tt = ts;
struct tm tm;
misc_utils::get_gmt_time(tt, tm);
epee::misc_utils::get_gmt_time(tt, tm);
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S UTC", &tm);
return std::string(buffer);
}

View File

@ -30,7 +30,6 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include "include_base_utils.h"
using namespace epee;
#include "cryptonote_basic_impl.h"
#include "string_tools.h"
@ -283,7 +282,7 @@ namespace cryptonote {
{
// Old address format
std::string buff;
if(!string_tools::parse_hexstr_to_binbuff(str, buff))
if(!epee::string_tools::parse_hexstr_to_binbuff(str, buff))
return false;
if(buff.size()!=sizeof(public_address_outer_blob))

View File

@ -45,8 +45,6 @@
#include "cryptonote_core/service_node_voting.h"
#include "cryptonote_core/loki_name_system.h"
using namespace epee;
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "cn"
@ -392,7 +390,7 @@ namespace cryptonote
str_amount.append(default_decimal_point - fraction_size, '0');
}
return string_tools::get_xtype_from_string(amount, str_amount);
return epee::string_tools::get_xtype_from_string(amount, str_amount);
}
//---------------------------------------------------------------
uint64_t get_transaction_weight(const transaction &tx, size_t blob_size)
@ -483,14 +481,14 @@ namespace cryptonote
{
tx_extra_field field;
bool r = ::do_serialize(ar, field);
CHECK_AND_NO_ASSERT_MES_L1(r, false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
CHECK_AND_NO_ASSERT_MES_L1(r, false, "failed to deserialize extra field. extra = " << to_hex(lokimq::ustring_view{tx_extra.data(), tx_extra.size()}));
tx_extra_fields.push_back(field);
std::ios_base::iostate state = iss.rdstate();
eof = (EOF == iss.peek());
iss.clear(state);
}
CHECK_AND_NO_ASSERT_MES_L1(::serialization::check_stream_state(ar), false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
CHECK_AND_NO_ASSERT_MES_L1(::serialization::check_stream_state(ar), false, "failed to deserialize extra field. extra = " << to_hex(lokimq::ustring_view{tx_extra.data(), tx_extra.size()}));
return true;
}
@ -531,7 +529,7 @@ namespace cryptonote
bool r = ::do_serialize(ar, field);
if (!r)
{
MWARNING("failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
MWARNING("failed to deserialize extra field. extra = " << to_hex(lokimq::ustring_view{tx_extra.data(), tx_extra.size()}));
if (!allow_partial)
return false;
break;
@ -545,7 +543,7 @@ namespace cryptonote
}
if (!::serialization::check_stream_state(ar))
{
MWARNING("failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
MWARNING("failed to deserialize extra field. extra = " << to_hex(lokimq::ustring_view{tx_extra.data(), tx_extra.size()}));
if (!allow_partial)
return false;
}
@ -911,7 +909,7 @@ namespace cryptonote
{
tx_extra_field field;
bool r = ::do_serialize(ar, field);
CHECK_AND_NO_ASSERT_MES_L1(r, false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
CHECK_AND_NO_ASSERT_MES_L1(r, false, "failed to deserialize extra field. extra = " << to_hex(lokimq::ustring_view{tx_extra.data(), tx_extra.size()}));
if (field.type() != type)
::do_serialize(newar, field);
@ -919,7 +917,7 @@ namespace cryptonote
eof = (EOF == iss.peek());
iss.clear(state);
}
CHECK_AND_NO_ASSERT_MES_L1(::serialization::check_stream_state(ar), false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
CHECK_AND_NO_ASSERT_MES_L1(::serialization::check_stream_state(ar), false, "failed to deserialize extra field. extra = " << to_hex(lokimq::ustring_view{tx_extra.data(), tx_extra.size()}));
tx_extra.clear();
std::string s = oss.str();
tx_extra.reserve(s.size());
@ -1081,7 +1079,7 @@ namespace cryptonote
//---------------------------------------------------------------
std::string short_hash_str(const crypto::hash& h)
{
std::string res = string_tools::pod_to_hex(h);
std::string res = epee::string_tools::pod_to_hex(h);
CHECK_AND_ASSERT_MES(res.size() == 64, res, "wrong hash256 with string_tools::pod_to_hex conversion");
auto erased_pos = res.erase(8, 48);
res.insert(8, "....");

View File

@ -33,10 +33,10 @@
#include <boost/endian/conversion.hpp>
#include "string_tools.h"
using namespace epee;
#include <unordered_set>
#include <iomanip>
#include <lokimq/hex.h>
extern "C" {
#include <sodium.h>
@ -49,6 +49,7 @@ extern "C" {
#include "cryptonote_core.h"
#include "common/util.h"
#include "common/base32z.h"
#include "common/updates.h"
#include "common/download.h"
#include "common/threadpool.h"
@ -2102,15 +2103,15 @@ namespace cryptonote
main_message = "The daemon is running offline and will not attempt to sync to the Loki network.";
else
main_message = "The daemon will start synchronizing with the network. This may take a long time to complete.";
MGINFO_YELLOW(ENDL << "**********************************************************************" << ENDL
<< main_message << ENDL
<< ENDL
<< "You can set the level of process detailization through \"set_log <level|categories>\" command," << ENDL
<< "where <level> is between 0 (no details) and 4 (very verbose), or custom category based levels (eg, *:WARNING)." << ENDL
<< ENDL
<< "Use the \"help\" command to see the list of available commands." << ENDL
<< "Use \"help <command>\" to see a command's documentation." << ENDL
<< "**********************************************************************" << ENDL);
MGINFO_YELLOW("\n**********************************************************************\n"
<< main_message << "\n"
<< "\n"
<< "You can set the level of process detailization through \"set_log <level|categories>\" command,\n"
<< "where <level> is between 0 (no details) and 4 (very verbose), or custom category based levels (eg, *:WARNING).\n"
<< "\n"
<< "Use the \"help\" command to see the list of available commands.\n"
<< "Use \"help <command>\" to see a command's documentation.\n"
<< "**********************************************************************\n");
m_starter_message_showed = true;
}

View File

@ -32,8 +32,6 @@
#include <random>
#include "include_base_utils.h"
#include "string_tools.h"
using namespace epee;
#include "common/apply_permutation.h"
#include "cryptonote_tx_utils.h"
#include "cryptonote_config.h"
@ -591,9 +589,9 @@ namespace cryptonote
//check that derivated key is equal with real output key (if non multisig)
if(!msout && !(in_ephemeral.pub == src_entr.outputs[src_entr.real_output].second.dest) )
{
LOG_ERROR("derived public key mismatch with output public key at index " << idx << ", real out " << src_entr.real_output << "! "<< ENDL << "derived_key:"
<< string_tools::pod_to_hex(in_ephemeral.pub) << ENDL << "real output_public_key:"
<< string_tools::pod_to_hex(src_entr.outputs[src_entr.real_output].second.dest) );
LOG_ERROR("derived public key mismatch with output public key at index " << idx << ", real out " << src_entr.real_output << "!\nderived_key:"
<< epee::string_tools::pod_to_hex(in_ephemeral.pub) << "\nreal output_public_key:"
<< epee::string_tools::pod_to_hex(src_entr.outputs[src_entr.real_output].second.dest) );
LOG_ERROR("amount " << src_entr.amount << ", rct " << src_entr.rct);
LOG_ERROR("tx pubkey " << src_entr.real_out_tx_key << ", real_output_in_tx_index " << src_entr.real_output_in_tx_index);
return false;
@ -772,7 +770,7 @@ namespace cryptonote
size_t i = 0;
for(const tx_source_entry& src_entr: sources)
{
ss_ring_s << "pub_keys:" << ENDL;
ss_ring_s << "pub_keys:\n";
std::vector<const crypto::public_key*> keys_ptrs;
std::vector<crypto::public_key> keys(src_entr.outputs.size());
size_t ii = 0;
@ -780,7 +778,7 @@ namespace cryptonote
{
keys[ii] = rct2pk(o.second.dest);
keys_ptrs.push_back(&keys[ii]);
ss_ring_s << o.second.dest << ENDL;
ss_ring_s << o.second.dest << "\n";
++ii;
}
@ -789,13 +787,13 @@ namespace cryptonote
sigs.resize(src_entr.outputs.size());
if (!zero_secret_key)
crypto::generate_ring_signature(tx_prefix_hash, boost::get<txin_to_key>(tx.vin[i]).k_image, keys_ptrs, in_contexts[i].in_ephemeral.sec, src_entr.real_output, sigs.data());
ss_ring_s << "signatures:" << ENDL;
std::for_each(sigs.begin(), sigs.end(), [&](const crypto::signature& s){ss_ring_s << s << ENDL;});
ss_ring_s << "prefix_hash:" << tx_prefix_hash << ENDL << "in_ephemeral_key: " << in_contexts[i].in_ephemeral.sec << ENDL << "real_output: " << src_entr.real_output << ENDL;
ss_ring_s << "signatures:\n";
std::for_each(sigs.begin(), sigs.end(), [&](const crypto::signature& s){ss_ring_s << s << "\n";});
ss_ring_s << "prefix_hash:" << tx_prefix_hash << "\nin_ephemeral_key: " << in_contexts[i].in_ephemeral.sec << "\nreal_output: " << src_entr.real_output << "\n";
i++;
}
MCINFO("construct_tx", "transaction_created: " << get_transaction_hash(tx) << ENDL << obj_to_json_str(tx) << ENDL << ss_ring_s.str());
MCINFO("construct_tx", "transaction_created: " << get_transaction_hash(tx) << "\n" << obj_to_json_str(tx) << "\n" << ss_ring_s.str());
}
else
{
@ -923,7 +921,7 @@ namespace cryptonote
CHECK_AND_ASSERT_MES(tx.vout.size() == outSk.size(), false, "outSk size does not match vout");
MCINFO("construct_tx", "transaction_created: " << get_transaction_hash(tx) << ENDL << obj_to_json_str(tx) << ENDL);
MCINFO("construct_tx", "transaction_created: " << get_transaction_hash(tx) << "\n" << obj_to_json_str(tx) << "\n");
}
tx.invalidate_hashes();
@ -979,7 +977,7 @@ namespace cryptonote
bl = {};
blobdata tx_bl;
bool r = string_tools::parse_hexstr_to_binbuff(genesis_tx, tx_bl);
bool r = epee::string_tools::parse_hexstr_to_binbuff(genesis_tx, tx_bl);
CHECK_AND_ASSERT_MES(r, false, "failed to parse coinbase tx from hard coded blob");
r = parse_and_validate_tx_from_blob(tx_bl, bl.miner_tx);
CHECK_AND_ASSERT_MES(r, false, "failed to parse coinbase tx from hard coded blob");

View File

@ -50,8 +50,6 @@
#define AUTODETECT_WINDOW 10 // seconds
#define AUTODETECT_GAIN_THRESHOLD 1.02f // 2%
using namespace epee;
#include "miner.h"
extern "C" void rx_slow_hash_allocate_state();
@ -166,7 +164,7 @@ namespace cryptonote
{
if(m_last_hr_merge_time && is_mining())
{
m_current_hash_rate = m_hashes * 1000 / ((misc_utils::get_tick_count() - m_last_hr_merge_time + 1));
m_current_hash_rate = m_hashes * 1000 / ((epee::misc_utils::get_tick_count() - m_last_hr_merge_time + 1));
CRITICAL_REGION_LOCAL(m_last_hash_rates_lock);
m_last_hash_rates.push_back(m_current_hash_rate);
if(m_last_hash_rates.size() > 19)
@ -177,10 +175,10 @@ namespace cryptonote
float hr = static_cast<float>(total_hr)/static_cast<float>(m_last_hash_rates.size());
const auto flags = std::cout.flags();
const auto precision = std::cout.precision();
std::cout << "hashrate: " << std::setprecision(4) << std::fixed << hr << std::setiosflags(flags) << std::setprecision(precision) << ENDL;
std::cout << "hashrate: " << std::setprecision(4) << std::fixed << hr << std::setiosflags(flags) << std::setprecision(precision) << std::endl;
}
}
m_last_hr_merge_time = misc_utils::get_tick_count();
m_last_hr_merge_time = epee::misc_utils::get_tick_count();
m_hashes = 0;
}
//-----------------------------------------------------------------------------------------------------
@ -229,7 +227,7 @@ namespace cryptonote
CRITICAL_REGION_LOCAL(m_threads_lock);
m_stop = true;
while (m_threads_active > 0)
misc_utils::sleep_no_w(100);
epee::misc_utils::sleep_no_w(100);
m_threads.clear();
}
m_stop = false;
@ -250,17 +248,17 @@ namespace cryptonote
if(command_line::has_arg(vm, arg_extra_messages))
{
std::string buff;
bool r = file_io_utils::load_file_to_string(command_line::get_arg(vm, arg_extra_messages), buff);
bool r = epee::file_io_utils::load_file_to_string(command_line::get_arg(vm, arg_extra_messages), buff);
CHECK_AND_ASSERT_MES(r, false, "Failed to load file with extra messages: " << command_line::get_arg(vm, arg_extra_messages));
std::vector<std::string> extra_vec;
boost::split(extra_vec, buff, boost::is_any_of("\n"), boost::token_compress_on );
m_extra_messages.resize(extra_vec.size());
for(size_t i = 0; i != extra_vec.size(); i++)
{
string_tools::trim(extra_vec[i]);
epee::string_tools::trim(extra_vec[i]);
if(!extra_vec[i].size())
continue;
std::string buff = string_encoding::base64_decode(extra_vec[i]);
std::string buff = epee::string_encoding::base64_decode(extra_vec[i]);
if(buff != "0")
m_extra_messages[i] = buff;
}
@ -456,7 +454,7 @@ namespace cryptonote
{
if(m_pausers_count)//anti split workaround
{
misc_utils::sleep_no_w(100);
epee::misc_utils::sleep_no_w(100);
continue;
}

View File

@ -857,8 +857,8 @@ namespace cryptonote
CHECKED_GET_SPECIFIC_VARIANT(in, const txin_to_key, txin, false);
std::unordered_set<crypto::hash>& kei_image_set = m_spent_key_images[txin.k_image];
CHECK_AND_ASSERT_MES(kept_by_block || kei_image_set.size() == 0, false, "internal error: kept_by_block=" << kept_by_block
<< ", kei_image_set.size()=" << kei_image_set.size() << ENDL << "txin.k_image=" << txin.k_image << ENDL
<< "tx_id=" << id );
<< ", kei_image_set.size()=" << kei_image_set.size() << "\ntxin.k_image=" << txin.k_image
<< "\ntx_id=" << id );
auto ins_res = kei_image_set.insert(id);
CHECK_AND_ASSERT_MES(ins_res.second, false, "internal error: try to insert duplicate iterator in key_image set");
}
@ -878,15 +878,15 @@ namespace cryptonote
{
CHECKED_GET_SPECIFIC_VARIANT(vi, const txin_to_key, txin, false);
auto it = m_spent_key_images.find(txin.k_image);
CHECK_AND_ASSERT_MES(it != m_spent_key_images.end(), false, "failed to find transaction input in key images. img=" << txin.k_image << ENDL
<< "transaction id = " << actual_hash);
CHECK_AND_ASSERT_MES(it != m_spent_key_images.end(), false, "failed to find transaction input in key images. img=" << txin.k_image
<< "\ntransaction id = " << actual_hash);
std::unordered_set<crypto::hash>& key_image_set = it->second;
CHECK_AND_ASSERT_MES(key_image_set.size(), false, "empty key_image set, img=" << txin.k_image << ENDL
<< "transaction id = " << actual_hash);
CHECK_AND_ASSERT_MES(key_image_set.size(), false, "empty key_image set, img=" << txin.k_image
<< "\ntransaction id = " << actual_hash);
auto it_in_set = key_image_set.find(actual_hash);
CHECK_AND_ASSERT_MES(it_in_set != key_image_set.end(), false, "transaction id not found in key_image set, img=" << txin.k_image << ENDL
<< "transaction id = " << actual_hash);
CHECK_AND_ASSERT_MES(it_in_set != key_image_set.end(), false, "transaction id not found in key_image set, img=" << txin.k_image
<< "\ntransaction id = " << actual_hash);
key_image_set.erase(it_in_set);
if(!key_image_set.size())
{

View File

@ -223,7 +223,7 @@ namespace cryptonote
<< std::setw(14) << "Down(now)"
<< std::setw(10) << "Up (kB/s)"
<< std::setw(13) << "Up(now)"
<< ENDL;
<< "\n";
m_p2p->for_each_connection([&](const connection_context& cntxt, nodetool::peerid_type peer_id, uint32_t support_flags)
{
@ -242,7 +242,7 @@ namespace cryptonote
<< std::setw(13) << std::fixed << cntxt.m_current_speed_up / 1024
<< (local_ip ? "[LAN]" : "")
<< std::left << (cntxt.m_remote_address.is_loopback() ? "[LOCALHOST]" : "") // 127.0.0.1
<< ENDL;
<< "\n";
if (connection_time > 1)
{
@ -255,14 +255,14 @@ namespace cryptonote
return true;
});
ss << ENDL
ss << "\n"
<< std::setw(125) << " "
<< std::setw(12) << down_sum
<< std::setw(14) << down_curr_sum
<< std::setw(10) << up_sum
<< std::setw(13) << up_curr_sum
<< ENDL;
LOG_PRINT_L0("Connections: " << ENDL << ss.str());
<< "\n";
LOG_PRINT_L0("Connections:\n" << ss.str());
}
//------------------------------------------------------------------------------------------------------------------------
// Returns a list of connection_info objects describing each open p2p connection
@ -476,7 +476,7 @@ namespace cryptonote
MCLOG(is_inital ? el::Level::Info : el::Level::Debug, "global", context << "Sync data returned a new top block candidate: " << curr_height << " -> " << hshd.current_height
<< " [Your node is " << abs_diff << " blocks (" << (abs_diff / (24 * 60 * 60 / DIFFICULTY_TARGET_V2)) << " days) "
<< (0 <= diff ? std::string("behind") : std::string("ahead"))
<< "] " << ENDL << "SYNCHRONIZATION started");
<< "]\nSYNCHRONIZATION started");
if (hshd.current_height >= curr_height + 5) // don't switch to unsafe mode just for a few blocks
{
m_core.safesyncmode(false);
@ -2255,10 +2255,10 @@ skip:
bool val_expected = false;
if(m_synchronized.compare_exchange_strong(val_expected, true))
{
MGINFO_YELLOW(ENDL << "**********************************************************************" << ENDL
<< "You are now synchronized with the network. You may now start loki-wallet-cli." << ENDL
<< ENDL
<< "Use the \"help\" command to see the list of available commands." << ENDL
MGINFO_YELLOW("\n**********************************************************************\n"
<< "You are now synchronized with the network. You may now start loki-wallet-cli.\n"
<< "\n"
<< "Use the \"help\" command to see the list of available commands.\n"
<< "**********************************************************************");
m_sync_timer.pause();
if (ELPP->vRegistry()->allowed(el::Level::Info, "sync-info"))

View File

@ -50,8 +50,6 @@
#include "command_server.h"
#include "daemon.h"
using namespace epee;
#include <functional>
#undef LOKI_DEFAULT_LOG_CATEGORY
@ -118,7 +116,7 @@ static uint16_t parse_public_rpc_port(const boost::program_options::variables_ma
throw std::runtime_error("restricted RPC mode is required for --" + std::string{public_node_arg.name});
uint16_t rpc_port;
if (!string_tools::get_xtype_from_string(rpc_port, rpc_port_str))
if (!epee::string_tools::get_xtype_from_string(rpc_port, rpc_port_str))
throw std::runtime_error("invalid RPC port " + rpc_port_str);
const auto rpc_bind_address = command_line::get_arg(vm, cryptonote::rpc_args::descriptors().rpc_bind_ip);

View File

@ -120,7 +120,7 @@ int main(int argc, char const * argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << "Usage: " + std::string{argv[0]} + " [options|settings] [daemon_command...]" << std::endl << std::endl;
std::cout << visible_options << std::endl;
return 0;
@ -129,7 +129,7 @@ int main(int argc, char const * argv[])
// Loki Version
if (command_line::get_arg(vm, command_line::arg_version))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
return 0;
}
@ -160,7 +160,7 @@ int main(int argc, char const * argv[])
const bool regtest = command_line::get_arg(vm, cryptonote::arg_regtest_on);
if (testnet + stagenet + regtest > 1)
{
std::cerr << "Can't specify more than one of --tesnet and --stagenet and --regtest" << ENDL;
std::cerr << "Can't specify more than one of --tesnet and --stagenet and --regtest\n";
return 1;
}

View File

@ -1135,7 +1135,7 @@ bool rpc_command_executor::print_block_by_hash(crypto::hash block_hash, bool inc
if (include_hex)
tools::success_msg_writer() << res.blob << std::endl;
print_block_header(res.block_header);
tools::success_msg_writer() << res.json << ENDL;
tools::success_msg_writer() << res.json << "\n";
return true;
}
@ -1167,9 +1167,9 @@ bool rpc_command_executor::print_block_by_height(uint64_t height, bool include_h
}
if (include_hex)
tools::success_msg_writer() << res.blob << std::endl;
tools::success_msg_writer() << res.blob << "\n";
print_block_header(res.block_header);
tools::success_msg_writer() << res.json << ENDL;
tools::success_msg_writer() << res.json << "\n";
return true;
}
@ -1238,7 +1238,7 @@ bool rpc_command_executor::print_transaction(crypto::hash transaction_hash,
cryptonote::blobdata blob;
std::string source = as_hex.empty() ? pruned_as_hex + prunable_as_hex : as_hex;
bool pruned = !pruned_as_hex.empty() && prunable_as_hex.empty();
if (!string_tools::parse_hexstr_to_binbuff(source, blob))
if (!epee::string_tools::parse_hexstr_to_binbuff(source, blob))
{
tools::fail_msg_writer() << "Failed to parse tx to get json format";
}

View File

@ -40,7 +40,6 @@
#define LOKI_DEFAULT_LOG_CATEGORY "debugtools.deserialize"
namespace po = boost::program_options;
using namespace epee;
using namespace cryptonote;
@ -104,7 +103,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n\n";
std::cout << desc_options << std::endl;
return 1;
}

View File

@ -48,8 +48,6 @@
#include "wallet/wallet_args.h"
#include "wallet/wallet2.h"
using namespace std;
using namespace epee;
using namespace cryptonote;
using boost::lexical_cast;
namespace po = boost::program_options;

View File

@ -2310,7 +2310,7 @@ namespace nodetool
std::vector<peerlist_entry> pl_gray;
for (auto& zone : m_network_zones)
zone.second.m_peerlist.get_peerlist(pl_gray, pl_white);
MINFO(ENDL << "Peerlist white:" << ENDL << print_peerlist_to_string(pl_white) << ENDL << "Peerlist gray:" << ENDL << print_peerlist_to_string(pl_gray) );
MINFO("\nPeerlist white:\n" << print_peerlist_to_string(pl_white) << "\nPeerlist gray:\n" << print_peerlist_to_string(pl_gray) );
return true;
}
//-----------------------------------------------------------------------------------

View File

@ -35,8 +35,6 @@
#include <cstring>
#include "include_base_utils.h"
#include "string_tools.h"
using namespace epee;
#include "core_rpc_server.h"
#include "common/command_line.h"
#include "common/updates.h"
@ -87,6 +85,8 @@ struct hash<lns::generic_owner>
};
} // namespace std
namespace string_tools = epee::string_tools;
namespace cryptonote
{
//-----------------------------------------------------------------------------------
@ -857,7 +857,6 @@ namespace cryptonote
if (req.blink)
{
using namespace std::chrono_literals;
auto future = m_core.handle_blink_tx(tx_blob);
auto status = future.wait_for(10s);
if (status != std::future_status::ready) {
@ -1625,7 +1624,7 @@ namespace cryptonote
json_req.id = epee::serialization::storage_entry(0);
json_req.method = command_name;
json_req.params = req;
r = net_utils::invoke_http_json("/json_rpc", json_req, json_resp, m_http_client);
r = epee::net_utils::invoke_http_json("/json_rpc", json_req, json_resp, m_http_client);
if (r)
res = json_resp.result;
}

View File

@ -47,10 +47,6 @@
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "daemon.rpc"
// yes, epee doesn't properly use its full namespace when calling its
// functions from macros. *sigh*
using namespace epee;
namespace cryptonote
{
static constexpr auto rpc_long_poll_timeout = 15s;

View File

@ -101,12 +101,11 @@ extern "C"
#define PAUSE_READLINE()
#endif
using namespace std;
using namespace epee;
using namespace cryptonote;
using boost::lexical_cast;
namespace po = boost::program_options;
typedef cryptonote::simple_wallet sw;
namespace string_tools = epee::string_tools;
using sw = cryptonote::simple_wallet;
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "wallet.simplewallet"
@ -385,7 +384,7 @@ namespace
tools::scoped_message_writer success_msg_writer(bool color = false)
{
return tools::scoped_message_writer(color ? console_color_green : console_color_default, false, std::string(), el::Level::Info);
return tools::scoped_message_writer(color ? epee::console_color_green : epee::console_color_default, false, std::string{}, el::Level::Info);
}
tools::scoped_message_writer message_writer(epee::console_colors color = epee::console_color_default, bool bright = false)
@ -395,7 +394,7 @@ namespace
tools::scoped_message_writer fail_msg_writer()
{
return tools::scoped_message_writer(console_color_red, true, sw::tr("Error: "), el::Level::Error);
return tools::scoped_message_writer(epee::console_color_red, true, sw::tr("Error: "), el::Level::Error);
}
bool parse_bool(const std::string& s, bool& result)
@ -645,7 +644,7 @@ namespace
void print_secret_key(const crypto::secret_key &k)
{
lokimq::string_view data{reinterpret_cast<const char*>(k.data), sizeof(k.data)};
lokimq::string_view data{k.data, sizeof(k.data)};
std::ostream_iterator<char> osi{std::cout};
lokimq::to_hex(data.begin(), data.end(), osi);
}
@ -683,11 +682,9 @@ std::string simple_wallet::get_command_usage(const std::vector<std::string> &arg
{
std::string usage = documentation.second.empty() ? args.front() : documentation.first;
std::string description = documentation.second.empty() ? documentation.first : documentation.second;
usage.insert(0, " ");
ss << tr("Command usage: ") << ENDL << usage << ENDL << ENDL;
ss << tr("Command usage: ") << "\n " << usage << "\n\n";
boost::replace_all(description, "\n", "\n ");
description.insert(0, " ");
ss << tr("Command description: ") << ENDL << description << ENDL;
ss << tr("Command description: ") << "\n " << description << "\n";
}
return ss.str();
}
@ -1534,7 +1531,7 @@ bool simple_wallet::submit_multisig_main(const std::vector<std::string> &args, b
for (auto &ptx: txs.m_ptx)
{
m_wallet->commit_tx(ptx, FIXME_blink);
success_msg_writer(true) << tr("Transaction successfully submitted, transaction ") << get_transaction_hash(ptx.tx) << ENDL
success_msg_writer(true) << tr("Transaction successfully submitted, transaction ") << get_transaction_hash(ptx.tx) << "\n"
<< tr("You can check its status by using the `show_transfers` command.");
}
}
@ -2158,7 +2155,7 @@ bool simple_wallet::cold_sign_tx(const std::vector<tools::wallet2::pending_tx>&
{
std::vector<std::string> tx_aux;
message_writer(console_color_white, false) << tr("Please confirm the transaction on the device");
message_writer(epee::console_color_white, false) << tr("Please confirm the transaction on the device");
m_wallet->cold_sign_tx(ptx_vector, exported_txs, dsts_info, tx_aux);
@ -3948,13 +3945,13 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
m_wallet->callback(this);
if (welcome)
message_writer(console_color_yellow, true) << tr("If you are new to Loki, type \"welcome\" for a brief overview.");
message_writer(epee::console_color_yellow, true) << tr("If you are new to Loki, type \"welcome\" for a brief overview.");
if (m_long_payment_id_support)
{
message_writer(console_color_red, false) <<
message_writer(epee::console_color_red, false) <<
tr("WARNING: obsolete long payment IDs are enabled. Sending transactions with those payment IDs are bad for your privacy.");
message_writer(console_color_red, false) <<
message_writer(epee::console_color_red, false) <<
tr("It is recommended that you do not use them, and ask recipients who ask for one to not endanger your privacy.");
}
@ -4132,7 +4129,7 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
if (was_deprecated_wallet)
{
// The user had used an older version of the wallet with old style mnemonics.
message_writer(console_color_green, false) << "\n" << tr("You had been using "
message_writer(epee::console_color_green, false) << "\n" << tr("You had been using "
"a deprecated version of the wallet. Please use the new seed that we provide.\n");
}
mnemonic_language = get_mnemonic_language();
@ -4148,7 +4145,7 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
try
{
recovery_val = m_wallet->generate(m_wallet_file, std::move(rc.second).password(), recovery_key, recover, two_random, create_address_file);
message_writer(console_color_white, true) << tr("Generated new wallet: ")
message_writer(epee::console_color_white, true) << tr("Generated new wallet: ")
<< m_wallet->get_account().get_public_address_str(m_wallet->nettype());
PAUSE_READLINE();
std::cout << tr("View key: ");
@ -4220,7 +4217,7 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
{
m_wallet->generate(m_wallet_file, std::move(rc.second).password(), address, viewkey, create_address_file);
}
message_writer(console_color_white, true) << tr("Generated new wallet: ")
message_writer(epee::console_color_white, true) << tr("Generated new wallet: ")
<< m_wallet->get_account().get_public_address_str(m_wallet->nettype());
}
catch (const std::exception& e)
@ -4262,7 +4259,7 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
bool create_address_file = command_line::get_arg(vm, arg_create_address_file);
m_wallet->device_derivation_path(device_derivation_path);
m_wallet->restore(m_wallet_file, std::move(rc.second).password(), device_desc.empty() ? "Ledger" : device_desc, create_address_file);
message_writer(console_color_white, true) << tr("Generated new wallet on hw device: ")
message_writer(epee::console_color_white, true) << tr("Generated new wallet on hw device: ")
<< m_wallet->get_account().get_public_address_str(m_wallet->nettype());
}
catch (const std::exception& e)
@ -4315,7 +4312,7 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
fail_msg_writer() << tr("failed to generate new mutlisig wallet");
return {};
}
message_writer(console_color_white, true) << boost::format(tr("Generated new %u/%u multisig wallet: ")) % threshold % total
message_writer(epee::console_color_white, true) << boost::format(tr("Generated new %u/%u multisig wallet: ")) % threshold % total
<< m_wallet->get_account().get_public_address_str(m_wallet->nettype());
}
catch (const std::exception& e)
@ -4367,10 +4364,10 @@ boost::optional<epee::wipeable_string> simple_wallet::open_wallet(const boost::p
prefix = (boost::format(tr("Opened %u/%u multisig wallet%s")) % threshold % total % (ready ? "" : " (not yet finalized)")).str();
else
prefix = tr("Opened wallet");
message_writer(console_color_white, true) <<
message_writer(epee::console_color_white, true) <<
prefix << ": " << m_wallet->get_account().get_public_address_str(m_wallet->nettype());
if (m_wallet->get_account().get_device()) {
message_writer(console_color_white, true) << "Wallet is on device: " << m_wallet->get_account().get_device().get_name();
message_writer(epee::console_color_white, true) << "Wallet is on device: " << m_wallet->get_account().get_device().get_name();
}
// If the wallet file is deprecated, we should ask for mnemonic language again and store
// everything in the new format.
@ -4384,7 +4381,7 @@ boost::optional<epee::wipeable_string> simple_wallet::open_wallet(const boost::p
}
if (is_deterministic)
{
message_writer(console_color_green, false) << "\n" << tr("You had been using "
message_writer(epee::console_color_green, false) << "\n" << tr("You had been using "
"a deprecated version of the wallet. Please proceed to upgrade your wallet.\n");
std::string mnemonic_language = get_mnemonic_language();
if (mnemonic_language.empty())
@ -4399,7 +4396,7 @@ boost::optional<epee::wipeable_string> simple_wallet::open_wallet(const boost::p
}
else
{
message_writer(console_color_green, false) << "\n" << tr("You had been using "
message_writer(epee::console_color_green, false) << "\n" << tr("You had been using "
"a deprecated version of the wallet. Your wallet file format is being upgraded now.\n");
m_wallet->rewrite(m_wallet_file, password);
}
@ -4673,7 +4670,7 @@ void simple_wallet::on_new_block(uint64_t height, const cryptonote::block& block
void simple_wallet::on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index, uint64_t unlock_time, bool blink)
{
{
auto m = message_writer(console_color_green, false);
auto m = message_writer(epee::console_color_green, false);
m << "\r";
if (height == 0 && blink)
m << tr("Blink, ");
@ -4694,7 +4691,7 @@ void simple_wallet::on_money_received(uint64_t height, const crypto::hash &txid,
{
crypto::hash payment_id = crypto::null_hash;
if (get_payment_id_from_tx_extra_nonce(extra_nonce.nonce, payment_id))
message_writer(console_color_red, false) <<
message_writer(epee::console_color_red, false) <<
(m_long_payment_id_support ? tr("WARNING: this transaction uses an unencrypted payment ID: consider using subaddresses instead.") : tr("WARNING: this transaction uses an unencrypted payment ID: these are obsolete. Support will be withdrawn in the future. Use subaddresses instead."));
}
}
@ -4713,7 +4710,7 @@ void simple_wallet::on_unconfirmed_money_received(uint64_t height, const crypto:
//----------------------------------------------------------------------------------------------------
void simple_wallet::on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& in_tx, uint64_t amount, const cryptonote::transaction& spend_tx, const cryptonote::subaddress_index& subaddr_index)
{
message_writer(console_color_magenta, false) << "\r" <<
message_writer(epee::console_color_magenta, false) << "\r" <<
tr("Height ") << height << ", " <<
tr("txid ") << txid << ", " <<
tr("spent ") << print_money(amount) << ", " <<
@ -4740,7 +4737,7 @@ boost::optional<epee::wipeable_string> simple_wallet::on_get_password(const char
m_password_asked_on_height = m_wallet->get_blockchain_current_height();
m_password_asked_on_checksum = tx_pool_checksum;
message_writer(console_color_red, false) << boost::format(tr("Password needed %s")) % reason;
message_writer(epee::console_color_red, false) << boost::format(tr("Password needed %s")) % reason;
m_cmd_binder.print_prompt();
}
return boost::none;
@ -4764,7 +4761,7 @@ boost::optional<epee::wipeable_string> simple_wallet::on_get_password(const char
//----------------------------------------------------------------------------------------------------
void simple_wallet::on_device_button_request(uint64_t code)
{
message_writer(console_color_white, false) << tr("Device requires attention");
message_writer(epee::console_color_white, false) << tr("Device requires attention");
}
//----------------------------------------------------------------------------------------------------
boost::optional<epee::wipeable_string> simple_wallet::on_device_pin_request()
@ -4781,7 +4778,7 @@ boost::optional<epee::wipeable_string> simple_wallet::on_device_pin_request()
boost::optional<epee::wipeable_string> simple_wallet::on_device_passphrase_request(bool on_device)
{
if (on_device){
message_writer(console_color_white, true) << tr("Please enter the device passphrase on the device");
message_writer(epee::console_color_white, true) << tr("Please enter the device passphrase on the device");
return boost::none;
}
@ -4810,7 +4807,7 @@ void simple_wallet::on_refresh_finished(uint64_t start_height, uint64_t fetched_
std::string accepted = input_line(tr("Do you want to do it now? (Y/Yes/N/No): "));
if (std::cin.eof() || !command_line::is_yes(accepted)) {
message_writer(console_color_red, false) << tr("hw_key_images_sync skipped. Run command manually before a transfer.");
message_writer(epee::console_color_red, false) << tr("hw_key_images_sync skipped. Run command manually before a transfer.");
return;
}
@ -5068,7 +5065,7 @@ bool simple_wallet::show_incoming_transfers(const std::vector<std::string>& args
const std::pair<std::string, std::string> line = show_outputs_line(heights, blockchain_height, td.m_spent_height);
extra_string += std::string("\n ") + tr("Used at heights: ") + line.first + "\n " + line.second;
}
message_writer(td.m_spent ? console_color_magenta : console_color_green, false) <<
message_writer(td.m_spent ? epee::console_color_magenta : epee::console_color_green, false) <<
boost::format("%21s%8s%12s%8s%16u%68s%16u%s") %
print_money(td.amount()) %
(td.m_spent ? tr("T") : tr("F")) %
@ -5358,7 +5355,7 @@ bool simple_wallet::print_ring_members(const std::vector<tools::wallet2::pending
<< (are_keys_from_same_tx ? tr("the same transaction") : tr("blocks that are temporally very close"))
<< tr(", which can break the anonymity of ring signature. Make sure this is intentional!");
}
ostr << ENDL;
ostr << "\n";
}
return true;
}
@ -5456,7 +5453,7 @@ bool simple_wallet::confirm_and_send_tx(std::vector<cryptonote::address_parse_in
print_money(total_fee);
}
if (dust_in_fee != 0) prompt << boost::format(tr(", of which %s is dust from change")) % print_money(dust_in_fee);
if (dust_not_in_fee != 0) prompt << tr(".") << ENDL << boost::format(tr("A total of %s from dust change will be sent to dust address"))
if (dust_not_in_fee != 0) prompt << tr(".") << "\n" << boost::format(tr("A total of %s from dust change will be sent to dust address"))
% print_money(dust_not_in_fee);
if (lock_time_in_blocks > 0)
@ -5487,8 +5484,8 @@ bool simple_wallet::confirm_and_send_tx(std::vector<cryptonote::address_parse_in
{
prompt << tr("WARNING: this is a non default ring size, which may harm your privacy. Default is recommended.");
}
prompt << ENDL << ENDL << tr("Is this okay?");
prompt << "\n\n" << tr("Is this okay?");
std::string accepted = input_line(prompt.str(), true);
if (std::cin.eof())
return false;
@ -5627,8 +5624,8 @@ bool simple_wallet::transfer_main(Transfer transfer_type, const std::vector<std:
local_args.pop_back();
}
vector<cryptonote::address_parse_info> dsts_info;
vector<cryptonote::tx_destination_entry> dsts;
std::vector<cryptonote::address_parse_info> dsts_info;
std::vector<cryptonote::tx_destination_entry> dsts;
size_t num_subaddresses = 0;
for (size_t i = 0; i < local_args.size(); )
{
@ -7412,7 +7409,7 @@ bool simple_wallet::get_tx_key(const std::vector<std::string> &args_)
bool found_tx_key = m_wallet->get_tx_key(txid, tx_key, additional_tx_keys);
if (found_tx_key)
{
ostringstream oss;
std::ostringstream oss;
oss << epee::string_tools::pod_to_hex(tx_key);
for (size_t i = 0; i < additional_tx_keys.size(); ++i)
oss << epee::string_tools::pod_to_hex(additional_tx_keys[i]);
@ -7990,23 +7987,23 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
PAUSE_READLINE();
for (const auto& transfer : all_transfers)
{
enum console_colors color = console_color_white;
auto color = epee::console_color_white;
if (transfer.confirmed)
{
switch (transfer.pay_type)
{
case tools::pay_type::in: color = console_color_green; break;
case tools::pay_type::out: color = console_color_yellow; break;
case tools::pay_type::miner: color = console_color_cyan; break;
case tools::pay_type::governance: color = console_color_cyan; break;
case tools::pay_type::stake: color = console_color_blue; break;
case tools::pay_type::service_node: color = console_color_cyan; break;
default: color = console_color_magenta; break;
case tools::pay_type::in: color = epee::console_color_green; break;
case tools::pay_type::out: color = epee::console_color_yellow; break;
case tools::pay_type::miner: color = epee::console_color_cyan; break;
case tools::pay_type::governance: color = epee::console_color_cyan; break;
case tools::pay_type::stake: color = epee::console_color_blue; break;
case tools::pay_type::service_node: color = epee::console_color_cyan; break;
default: color = epee::console_color_magenta; break;
}
}
if (transfer.type == "failed")
color = console_color_red;
color = epee::console_color_red;
std::string destinations = "-";
if (!transfer.destinations.empty())
@ -8216,7 +8213,7 @@ bool simple_wallet::unspent_outputs(const std::vector<std::string> &args_)
success_msg_writer()
<< tr("\nBin size: ") << bin_size
<< tr("\nOutputs per *: ") << count_per_star;
ostringstream histogram_str;
std::ostringstream histogram_str;
histogram_str << tr("count\n ^\n");
for (size_t y = histogram_height; y > 0; --y)
histogram_str << tr(" |") << histogram_line[y - 1] << tr("|\n");
@ -8301,7 +8298,7 @@ void simple_wallet::check_for_messages()
bool new_message = get_message_store().check_for_messages(get_multisig_wallet_state(), new_messages);
if (new_message)
{
message_writer(console_color_magenta, true) << tr("MMS received new message");
message_writer(epee::console_color_magenta, true) << tr("MMS received new message");
list_mms_messages(new_messages);
m_cmd_binder.print_prompt();
}
@ -8392,7 +8389,7 @@ bool simple_wallet::run()
long_poll_thread_t long_poll_thread(*this);
if (!m_wallet->m_long_poll_disabled) long_poll_thread.start();
message_writer(console_color_green, false) << "Background refresh thread started";
message_writer(epee::console_color_green, false) << "Background refresh thread started";
#if defined(LOKI_ENABLE_INTEGRATION_TEST_HOOKS)
for (;;)
@ -9216,7 +9213,7 @@ bool simple_wallet::hw_key_images_sync(const std::vector<std::string> &args)
void simple_wallet::key_images_sync_intern(){
try
{
message_writer(console_color_white, false) << tr("Please confirm the key image sync on the device");
message_writer(epee::console_color_white, false) << tr("Please confirm the key image sync on the device");
uint64_t spent = 0, unspent = 0;
uint64_t height = m_wallet->cold_key_image_sync(spent, unspent);
@ -9791,7 +9788,7 @@ void simple_wallet::list_mms_messages(const std::vector<mms::message> &messages)
const mms::message &m = messages[i];
const mms::authorized_signer &signer = ms.get_signer(m.signer_index);
bool highlight = (m.state == mms::message_state::ready_to_send) || (m.state == mms::message_state::waiting);
message_writer(m.direction == mms::message_direction::out ? console_color_green : console_color_magenta, highlight) <<
message_writer(m.direction == mms::message_direction::out ? epee::console_color_green : epee::console_color_magenta, highlight) <<
boost::format("%4s %-4s %-30s %-21s %7s %3s %-15s %-40s") %
m.id %
ms.message_direction_to_string(m.direction) %
@ -10017,8 +10014,8 @@ void simple_wallet::mms_signer(const std::vector<std::string> &args)
return;
}
boost::optional<string> label = args[1];
boost::optional<string> transport_address;
boost::optional<std::string> label = args[1];
boost::optional<std::string> transport_address;
if (args.size() >= 3)
{
transport_address = args[2];
@ -10079,7 +10076,7 @@ void simple_wallet::mms_next(const std::vector<std::string> &args)
// those messages because no need to process them can be seen
force_sync = true;
}
string wait_reason;
std::string wait_reason;
{
avail = ms.get_processable_messages(get_multisig_wallet_state(), force_sync, data_list, wait_reason);
}

View File

@ -40,8 +40,6 @@
#include <string>
#include <list>
using namespace epee;
namespace Monero {
TransactionHistory::~TransactionHistory() {}

View File

@ -30,8 +30,6 @@
#include "storages/http_abstract_invoke.h"
#include <boost/thread.hpp>
using namespace epee;
namespace tools
{
@ -80,7 +78,7 @@ boost::optional<std::string> NodeRPCProxy::get_rpc_version(uint32_t &rpc_version
cryptonote::COMMAND_RPC_GET_VERSION::request req_t{};
cryptonote::COMMAND_RPC_GET_VERSION::response resp_t{};
m_daemon_rpc_mutex.lock();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_version", req_t, resp_t, m_http_client, rpc_timeout);
bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "get_version", req_t, resp_t, m_http_client, rpc_timeout);
m_daemon_rpc_mutex.unlock();
CHECK_AND_ASSERT_MES(r, std::string("Failed to connect to daemon"), "Failed to connect to daemon");
CHECK_AND_ASSERT_MES(resp_t.status != CORE_RPC_STATUS_BUSY, resp_t.status, "Failed to connect to daemon");
@ -109,7 +107,7 @@ boost::optional<std::string> NodeRPCProxy::get_info() const
cryptonote::COMMAND_RPC_GET_INFO::response resp_t{};
m_daemon_rpc_mutex.lock();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_info", req_t, resp_t, m_http_client, rpc_timeout);
bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "get_info", req_t, resp_t, m_http_client, rpc_timeout);
m_daemon_rpc_mutex.unlock();
CHECK_AND_ASSERT_MES(r, std::string("Failed to connect to daemon"), "Failed to connect to daemon");
@ -171,7 +169,7 @@ boost::optional<std::string> NodeRPCProxy::get_earliest_height(uint8_t version,
m_daemon_rpc_mutex.lock();
req_t.version = version;
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "hard_fork_info", req_t, resp_t, m_http_client, rpc_timeout);
bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "hard_fork_info", req_t, resp_t, m_http_client, rpc_timeout);
m_daemon_rpc_mutex.unlock();
CHECK_AND_ASSERT_MES(r, std::string("Failed to connect to daemon"), "Failed to connect to daemon");
CHECK_AND_ASSERT_MES(resp_t.status != CORE_RPC_STATUS_BUSY, resp_t.status, "Failed to connect to daemon");
@ -192,7 +190,7 @@ boost::optional<uint8_t> NodeRPCProxy::get_hardfork_version() const
cryptonote::COMMAND_RPC_HARD_FORK_INFO::response resp{};
m_daemon_rpc_mutex.lock();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "hard_fork_info", req, resp, m_http_client, rpc_timeout);
bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "hard_fork_info", req, resp, m_http_client, rpc_timeout);
m_daemon_rpc_mutex.unlock();
CHECK_AND_ASSERT_MES(r, {}, "Failed to connect to daemon");
CHECK_AND_ASSERT_MES(resp.status != CORE_RPC_STATUS_BUSY, {}, "Failed to connect to daemon");
@ -218,7 +216,7 @@ boost::optional<std::string> NodeRPCProxy::refresh_dynamic_base_fee_cache(uint64
m_daemon_rpc_mutex.lock();
req_t.grace_blocks = grace_blocks;
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_fee_estimate", req_t, resp_t, m_http_client, rpc_timeout);
bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "get_fee_estimate", req_t, resp_t, m_http_client, rpc_timeout);
m_daemon_rpc_mutex.unlock();
CHECK_AND_ASSERT_MES(r, std::string("Failed to connect to daemon"), "Failed to connect to daemon");
CHECK_AND_ASSERT_MES(resp_t.status != CORE_RPC_STATUS_BUSY, resp_t.status, "Failed to connect to daemon");

View File

@ -41,8 +41,6 @@
#include <boost/range/adaptor/transformed.hpp>
#include <boost/preprocessor/stringize.hpp>
#include "include_base_utils.h"
using namespace epee;
#include "common/rules.h"
#include "cryptonote_config.h"
#include "wallet2.h"
@ -95,10 +93,11 @@ extern "C"
#include <sodium.h>
}
using namespace std;
using namespace crypto;
using namespace cryptonote;
namespace string_tools = epee::string_tools;
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "wallet.wallet2"
@ -1627,7 +1626,7 @@ void wallet2::scan_output(const cryptonote::transaction &tx, bool miner_tx, cons
// if keys are encrypted, ask for password
if (m_ask_password == AskPasswordToDecrypt && !m_unattended && !m_watch_only && !m_multisig_rescan_k)
{
static critical_section password_lock;
static epee::critical_section password_lock;
CRITICAL_REGION_LOCAL(password_lock);
if (!m_encrypt_keys_after_refresh)
{
@ -4403,7 +4402,7 @@ void wallet2::create_keys_file(const std::string &wallet_, bool watch_only, cons
if (create_address_file)
{
r = file_io_utils::save_string_to_file(m_wallet_file + ".address.txt", m_account.get_public_address_str(m_nettype));
r = epee::file_io_utils::save_string_to_file(m_wallet_file + ".address.txt", m_account.get_public_address_str(m_nettype));
if(!r) MERROR("String with address text not saved");
}
}
@ -4974,7 +4973,7 @@ std::string wallet2::exchange_multisig_keys(const epee::wipeable_string &passwor
if (boost::filesystem::exists(m_wallet_file + ".address.txt"))
{
r = file_io_utils::save_string_to_file(m_wallet_file + ".address.txt", m_account.get_public_address_str(m_nettype));
r = epee::file_io_utils::save_string_to_file(m_wallet_file + ".address.txt", m_account.get_public_address_str(m_nettype));
if(!r) MERROR("String with address text not saved");
}
}
@ -5734,7 +5733,7 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas
{
// save address to the new file
const std::string address_file = m_wallet_file + ".address.txt";
r = file_io_utils::save_string_to_file(address_file, m_account.get_public_address_str(m_nettype));
r = epee::file_io_utils::save_string_to_file(address_file, m_account.get_public_address_str(m_nettype));
THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, m_wallet_file);
}
// remove old wallet file
@ -8029,7 +8028,7 @@ wallet2::stake_result wallet2::create_stake_tx(const crypto::public_key& service
add_service_node_pubkey_to_tx_extra(extra, service_node_key);
add_service_node_contributor_to_tx_extra(extra, address);
vector<cryptonote::tx_destination_entry> dsts;
std::vector<cryptonote::tx_destination_entry> dsts;
cryptonote::tx_destination_entry de = {};
de.addr = address;
de.is_subaddress = false;
@ -8306,7 +8305,7 @@ wallet2::register_service_node_result wallet2::create_register_service_node_tx(c
amount_payable_by_operator += amount_left;
}
vector<cryptonote::tx_destination_entry> dsts;
std::vector<cryptonote::tx_destination_entry> dsts;
cryptonote::tx_destination_entry de;
de.addr = address;
de.is_subaddress = false;
@ -10728,7 +10727,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
preferred_inputs = pick_preferred_rct_inputs(needed_money + estimated_fee, subaddr_account, subaddr_indices);
if (!preferred_inputs.empty())
{
string s;
std::string s;
for (auto i: preferred_inputs) s += boost::lexical_cast<std::string>(i) + " (" + print_money(m_transfers[i].amount()) + ") ";
LOG_PRINT_L1("Found preferred rct inputs for rct tx: " << s);
@ -12752,7 +12751,7 @@ std::string wallet2::get_daemon_address() const
return m_daemon_address;
}
uint64_t wallet2::get_daemon_blockchain_height(string &err) const
uint64_t wallet2::get_daemon_blockchain_height(std::string& err) const
{
uint64_t height;
@ -12770,7 +12769,7 @@ uint64_t wallet2::get_daemon_blockchain_height(string &err) const
return height;
}
uint64_t wallet2::get_daemon_blockchain_target_height(string &err)
uint64_t wallet2::get_daemon_blockchain_target_height(std::string& err)
{
err = "";
uint64_t target_height = 0;
@ -14292,7 +14291,7 @@ uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, ui
oss << "failed to get blocks by heights: ";
for (auto height : req.heights)
oss << height << ' ';
oss << endl << "reason: ";
oss << std::endl << "reason: ";
if (!r)
oss << "possibly lost connection to daemon";
else if (res.status == CORE_RPC_STATUS_BUSY)

View File

@ -155,10 +155,10 @@ namespace wallet_args
if (command_line::get_arg(vm, command_line::arg_help))
{
Print(print) << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")" << ENDL;
Print(print) << "Loki '" << LOKI_RELEASE_NAME << "' (v" << LOKI_VERSION_FULL << ")\n";
Print(print) << wallet_args::tr("This is the command line loki wallet. It needs to connect to a loki\n"
"daemon to work correctly.") << ENDL;
Print(print) << wallet_args::tr("Usage:") << ENDL << " " << usage;
"daemon to work correctly.") << "\n";
Print(print) << wallet_args::tr("Usage:") << "\n " << usage;
Print(print) << desc_visible;
should_terminate = true;
return true;
@ -211,7 +211,7 @@ namespace wallet_args
}
if (notice)
Print(print) << notice << ENDL;
Print(print) << notice << "\n";
if (!command_line::is_arg_defaulted(vm, arg_max_concurrency))
tools::set_max_concurrency(command_line::get_arg(vm, arg_max_concurrency));

View File

@ -224,7 +224,7 @@ namespace tools
crypto::rand(rand_128bit.size(), rand_128bit.data());
http_login.emplace(
default_rpc_username,
string_encoding::base64_encode(rand_128bit.data(), rand_128bit.size())
epee::string_encoding::base64_encode(rand_128bit.data(), rand_128bit.size())
);
std::string temp = "loki-wallet-rpc." + bind_port + ".login";

View File

@ -160,9 +160,9 @@ bool transactions_flow_test(std::string& working_folder,
w2.init(daemon_addr_b);
MGINFO_GREEN("Using wallets: " << ENDL
<< "Source: " << w1.get_account().get_public_address_str(MAINNET) << ENDL << "Path: " << working_folder + "/" + path_source_wallet << ENDL
<< "Target: " << w2.get_account().get_public_address_str(MAINNET) << ENDL << "Path: " << working_folder + "/" + path_target_wallet);
MGINFO_GREEN("Using wallets:\n"
<< "Source: " << w1.get_account().get_public_address_str(MAINNET) << "\nPath: " << working_folder + "/" + path_source_wallet << "\n"
<< "Target: " << w2.get_account().get_public_address_str(MAINNET) << "\nPath: " << working_folder + "/" + path_target_wallet);
//lets do some money
epee::net_utils::http::http_simple_client http_client;

View File

@ -142,7 +142,7 @@ bool make_tx(blockchain_storage& bch)
CHECK_AND_ASSERT_MES(r, false, "failed to send transaction");
if(daemon_send_resp.status != CORE_RPC_STATUS_OK)
{
std::cout << "daemon failed to accept generated transaction" << ENDL;
std::cout << "daemon failed to accept generated transaction" << std::endl;
return false;
}