From c51ef0cda768d77c5314de1f570d1258a4c82ab5 Mon Sep 17 00:00:00 2001 From: sowle Date: Tue, 19 Nov 2019 18:08:21 +0300 Subject: [PATCH 01/18] p2p: minor issues fixed --- src/p2p/net_node.h | 3 ++- src/p2p/net_node.inl | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 29ff8705..c57fa524 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -80,7 +80,8 @@ namespace nodetool m_ip_address{}, m_last_stat_request_time{}, m_use_only_priority_peers(false), - m_peer_livetime{} + m_peer_livetime{}, + m_debug_requests_enabled(false) {} diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 8557f89e..19c2bf64 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -100,9 +100,9 @@ namespace nodetool if (m_offline_mode) return false; - //@#@ workaround + //@#@ temporary workaround return true; - +#if 0 CRITICAL_REGION_LOCAL(m_blocked_ips_lock); auto it = m_blocked_ips.find(addr); if(it == m_blocked_ips.end()) @@ -114,6 +114,7 @@ namespace nodetool return true; } return false; +#endif } //----------------------------------------------------------------------------------- template From 5db4024be949974d7cc754b9f7c3e6e2d036354b Mon Sep 17 00:00:00 2001 From: sowle Date: Wed, 20 Nov 2019 10:24:47 +0300 Subject: [PATCH 02/18] wallet: fixed minor issue with dump_transfers() --- src/wallet/wallet2.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index da380010..cd4c4535 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3044,6 +3044,7 @@ void wallet2::dump_trunsfers(std::stringstream& ss, bool verbose) const } else { + boost::io::ios_flags_saver ifs(ss); ss << "index amount spent_h g_index block block_ts flg tx out# key image" << ENDL; for (size_t i = 0; i != m_transfers.size(); i++) { From 69143d828895cdd849f0f01a0f6d4fc23c185608 Mon Sep 17 00:00:00 2001 From: sowle Date: Wed, 20 Nov 2019 10:25:45 +0300 Subject: [PATCH 03/18] core: fixed uninitialized variable in construct_miner_tx --- src/currency_core/currency_format_utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index 79a63b06..f91e6889 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -87,7 +87,7 @@ namespace currency bool pos, const pos_entry& pe) { - uint64_t block_reward; + uint64_t block_reward = 0; if (!get_block_reward(pos, median_size, current_block_size, already_generated_coins, block_reward, height)) { LOG_ERROR("Block is too big"); From 3455811cc3de59343a3b2900de0b4e6f3fcef4dc Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 21 Nov 2019 16:44:42 +0300 Subject: [PATCH 04/18] core: CATCH_ENTRY_NO_RETURN made parameterless, CATCH_ENTRY_NO_RETURN_CUSTOM added --- contrib/epee/include/misc_helpers.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/epee/include/misc_helpers.h b/contrib/epee/include/misc_helpers.h index 8c5aba18..dd3067c8 100644 --- a/contrib/epee/include/misc_helpers.h +++ b/contrib/epee/include/misc_helpers.h @@ -77,7 +77,7 @@ /// @details Useful within a dtor - but only if nested within another try block /// (since we can still potentially throw here). See NESTED_*ENTRY() /// @todo Exception dispatcher class -#define CATCH_ENTRY_NO_RETURN(location, custom_code) } \ +#define CATCH_ENTRY_NO_RETURN_CUSTOM(location, custom_code) } \ catch(const std::exception& ex) \ { \ (void)(ex); \ @@ -90,6 +90,7 @@ custom_code; \ } +#define CATCH_ENTRY_NO_RETURN() CATCH_ENTRY_NO_RETURN_CUSTOM(LOCATION_SS, (void)0) #define CATCH_ENTRY_WITH_FORWARDING_EXCEPTION() } \ catch(const std::exception& ex) \ @@ -108,7 +109,7 @@ #define NESTED_TRY_ENTRY() try { TRY_ENTRY(); #define NESTED_CATCH_ENTRY(location) \ - CATCH_ENTRY_NO_RETURN(location, {}); \ + CATCH_ENTRY_NO_RETURN_CUSTOM(location, {}); \ } catch (...) {} From 03e4dfbbd22ca2a182459cc416dd591bd8e7100a Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 21 Nov 2019 16:45:44 +0300 Subject: [PATCH 05/18] fixed possible exception issues in miner dtor --- src/currency_core/miner.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/currency_core/miner.cpp b/src/currency_core/miner.cpp index ff2579e2..ff32d3e3 100644 --- a/src/currency_core/miner.cpp +++ b/src/currency_core/miner.cpp @@ -62,7 +62,9 @@ namespace currency //----------------------------------------------------------------------------------------------------- miner::~miner() { + TRY_ENTRY(); stop(); + CATCH_ENTRY_NO_RETURN(); } //----------------------------------------------------------------------------------------------------- bool miner::set_block_template(const block& bl, const wide_difficulty_type& di, uint64_t height) From 6d1f954f5d68efb3aeb7eaa614ac36ea60d7dc3e Mon Sep 17 00:00:00 2001 From: sowle Date: Fri, 22 Nov 2019 16:18:03 +0300 Subject: [PATCH 06/18] minor fix (uninitialized member variable) --- src/currency_core/miner.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/currency_core/miner.cpp b/src/currency_core/miner.cpp index ff32d3e3..005c274c 100644 --- a/src/currency_core/miner.cpp +++ b/src/currency_core/miner.cpp @@ -56,7 +56,8 @@ namespace currency m_current_hash_rate(0), m_last_hr_merge_time(0), m_hashes(0), - m_config(AUTO_VAL_INIT(m_config)) + m_config(AUTO_VAL_INIT(m_config)), + m_mine_address{} { } //----------------------------------------------------------------------------------------------------- From 75f3fb9500d8c62656a0d9383f46b063a12a979d Mon Sep 17 00:00:00 2001 From: sowle Date: Mon, 25 Nov 2019 13:43:33 +0300 Subject: [PATCH 07/18] core: minor fix in is_out_to_acc() --- src/currency_core/currency_format_utils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index f91e6889..d76c2768 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -1525,14 +1525,16 @@ namespace currency bool is_out_to_acc(const account_keys& acc, const txout_to_key& out_key, const crypto::key_derivation& derivation, size_t output_index) { crypto::public_key pk; - derive_public_key(derivation, output_index, acc.m_account_address.m_spend_public_key, pk); + if (!derive_public_key(derivation, output_index, acc.m_account_address.m_spend_public_key, pk)) + return false; return pk == out_key.key; } //--------------------------------------------------------------- bool is_out_to_acc(const account_keys& acc, const txout_multisig& out_multisig, const crypto::key_derivation& derivation, size_t output_index) { crypto::public_key pk; - derive_public_key(derivation, output_index, acc.m_account_address.m_spend_public_key, pk); + if (!derive_public_key(derivation, output_index, acc.m_account_address.m_spend_public_key, pk)) + return false; auto it = std::find(out_multisig.keys.begin(), out_multisig.keys.end(), pk); if (out_multisig.keys.end() == it) return false; From 781273fb0c0a46fe43f869ebba2207d163154d41 Mon Sep 17 00:00:00 2001 From: sowle Date: Tue, 26 Nov 2019 12:13:14 +0300 Subject: [PATCH 08/18] exceptions handling in bc_offers_service::~bc_offers_service() --- src/currency_core/bc_offers_service.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/currency_core/bc_offers_service.cpp b/src/currency_core/bc_offers_service.cpp index 44e1de3e..59064632 100644 --- a/src/currency_core/bc_offers_service.cpp +++ b/src/currency_core/bc_offers_service.cpp @@ -31,8 +31,10 @@ namespace bc_services //------------------------------------------------------------------ bc_offers_service::~bc_offers_service() { + TRY_ENTRY(); if (!m_deinitialized) deinit(); + CATCH_ENTRY_NO_RETURN(); } //------------------------------------------------------------------ bool bc_offers_service::init(const std::string& config_folder, const boost::program_options::variables_map& vm) From b043f8cc0f59c22b147b11eafbdec9619586b73a Mon Sep 17 00:00:00 2001 From: sowle Date: Tue, 26 Nov 2019 12:13:56 +0300 Subject: [PATCH 09/18] wallet: getting rid of unused code --- src/wallet/wallet2.cpp | 33 --------------------------------- src/wallet/wallet2.h | 1 - 2 files changed, 34 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index cd4c4535..258e5668 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3089,39 +3089,6 @@ bool wallet2::get_contracts(escrow_contracts_container& contracts) return true; } //---------------------------------------------------------------------------------------------------- -bool wallet2::get_fake_offers(std::list& offers, uint64_t amount) -{ - - for (uint64_t i = 0; i != amount; i++) - { - bc_services::offer_details od; - od.offer_type = rand() % 4; - od.amount_primary = rand(); - od.amount_target = rand(); - od.bonus = get_random_rext(10); - od.target = get_random_rext(10); - od.location_country = get_random_rext(6); - od.location_city = get_random_rext(10); - od.contacts = get_random_rext(20); - od.comment = get_random_rext(30); - od.payment_types = get_random_rext(10); - od.deal_option = get_random_rext(10); - od.category = get_random_rext(4); - od.expiration_time = 3; - - crypto::hash tx_id = crypto::rand(); - offers.push_back(bc_services::offer_details_ex()); - bc_services::offer_details_ex& odl = offers.back(); - static_cast(odl) = od; - odl.timestamp = m_core_runtime_config.get_core_time(); - odl.index_in_tx = 0; - odl.tx_hash = tx_id; - odl.stopped = false; - odl.fee = 10000; - } - return true; -} -//---------------------------------------------------------------------------------------------------- void wallet2::build_escrow_release_templates(crypto::hash multisig_id, uint64_t fee, currency::transaction& tx_release_template, diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index e1fd1d63..47107893 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -698,7 +698,6 @@ namespace tools bool reset_password(const std::string& pass); bool is_password_valid(const std::string& pass); bool get_actual_offers(std::list& offers); - bool get_fake_offers(std::list& offers, uint64_t amount); bool process_contract_info(wallet_public::wallet_transfer_info& wti, const std::vector& decrypted_attach); bool handle_proposal(wallet_public::wallet_transfer_info& wti, const bc_services::proposal_body& prop); void accept_proposal(const crypto::hash& contract_id, uint64_t b_acceptance_fee, currency::transaction* p_acceptance_tx = nullptr); From e3f2e2a30b40031ac1e92bb9220d85a9da000971 Mon Sep 17 00:00:00 2001 From: sowle Date: Fri, 29 Nov 2019 12:34:10 +0300 Subject: [PATCH 10/18] db: lmdb: minor fix in error handling macro --- src/common/db_backend_lmdb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/db_backend_lmdb.cpp b/src/common/db_backend_lmdb.cpp index b02a8fe7..69122969 100644 --- a/src/common/db_backend_lmdb.cpp +++ b/src/common/db_backend_lmdb.cpp @@ -11,8 +11,8 @@ #define BUF_SIZE 1024 -#define CHECK_AND_ASSERT_MESS_LMDB_DB(rc, ret, mess) CHECK_AND_ASSERT_MES(res == MDB_SUCCESS, ret, "[DB ERROR]:(" << rc << ")" << mdb_strerror(rc) << ", [message]: " << mess); -#define CHECK_AND_ASSERT_THROW_MESS_LMDB_DB(rc, mess) CHECK_AND_ASSERT_THROW_MES(res == MDB_SUCCESS, "[DB ERROR]:(" << rc << ")" << mdb_strerror(rc) << ", [message]: " << mess); +#define CHECK_AND_ASSERT_MESS_LMDB_DB(rc, ret, mess) CHECK_AND_ASSERT_MES(rc == MDB_SUCCESS, ret, "[DB ERROR]:(" << rc << ")" << mdb_strerror(rc) << ", [message]: " << mess); +#define CHECK_AND_ASSERT_THROW_MESS_LMDB_DB(rc, mess) CHECK_AND_ASSERT_THROW_MES(rc == MDB_SUCCESS, "[DB ERROR]:(" << rc << ")" << mdb_strerror(rc) << ", [message]: " << mess); #define ASSERT_MES_AND_THROW_LMDB(rc, mess) ASSERT_MES_AND_THROW("[DB ERROR]:(" << rc << ")" << mdb_strerror(rc) << ", [message]: " << mess); #undef LOG_DEFAULT_CHANNEL From 7f374eab2aa2e3651be3052721e1b36e7cea34d8 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Sun, 1 Dec 2019 23:31:05 +0100 Subject: [PATCH 11/18] fixed missing total field in get_recent_transfers struct --- src/gui/qt-daemon/application/daemon_backend.cpp | 2 +- src/wallet/wallet2.cpp | 3 ++- src/wallet/wallet2.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/qt-daemon/application/daemon_backend.cpp b/src/gui/qt-daemon/application/daemon_backend.cpp index dab77d8b..988c3cc9 100644 --- a/src/gui/qt-daemon/application/daemon_backend.cpp +++ b/src/gui/qt-daemon/application/daemon_backend.cpp @@ -716,7 +716,7 @@ std::string daemon_backend::get_recent_transfers(size_t wallet_id, uint64_t offs return API_RETURN_CODE_CORE_BUSY; } - w->get()->get_recent_transfers_history(tr_hist.history, offset, count); + w->get()->get_recent_transfers_history(tr_hist.history, offset, count, tr_hist.total_history_items); //workaround for missed fee for (auto & he : tr_hist.history) { diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 258e5668..db30ba58 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2515,7 +2515,7 @@ uint64_t wallet2::get_recent_transfers_total_count() return m_transfer_history.size(); } //---------------------------------------------------------------------------------------------------- -void wallet2::get_recent_transfers_history(std::vector& trs, size_t offset, size_t count) +void wallet2::get_recent_transfers_history(std::vector& trs, size_t offset, size_t count, uint64_t& total) { if (offset >= m_transfer_history.size()) return; @@ -2526,6 +2526,7 @@ void wallet2::get_recent_transfers_history(std::vector& trs, size_t offset, size_t count); + void get_recent_transfers_history(std::vector& trs, size_t offset, size_t count, uint64_t& total); uint64_t get_recent_transfers_total_count(); void get_unconfirmed_transfers(std::vector& trs); void init(const std::string& daemon_address = "http://localhost:8080"); From 6464a65b31f4cf915bf0a20a8ac6bcb700c5d334 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Sun, 1 Dec 2019 23:42:10 +0100 Subject: [PATCH 12/18] fixed open_wallet call --- src/gui/qt-daemon/application/daemon_backend.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/qt-daemon/application/daemon_backend.cpp b/src/gui/qt-daemon/application/daemon_backend.cpp index 988c3cc9..0bddba44 100644 --- a/src/gui/qt-daemon/application/daemon_backend.cpp +++ b/src/gui/qt-daemon/application/daemon_backend.cpp @@ -677,8 +677,7 @@ std::string daemon_backend::open_wallet(const std::wstring& path, const std::str try { w->load(path, password); - w->get_recent_transfers_history(owr.recent_history.history, 0, 0); - owr.recent_history.total_history_items = w->get_recent_transfers_total_count(); + w->get_recent_transfers_history(owr.recent_history.history, 0, 100, owr.recent_history.total_history_items); //w->get_unconfirmed_transfers(owr.recent_history.unconfirmed); w->get_unconfirmed_transfers(owr.recent_history.history); //workaround for missed fee From 9b8e438ab491e0747996e57239952e5db2c736e8 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Mon, 2 Dec 2019 00:20:16 +0100 Subject: [PATCH 13/18] fixed simplewallet issues with get_recent_transfers --- src/simplewallet/simplewallet.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 98cd5ba6..f6494f46 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -715,7 +715,8 @@ bool simple_wallet::list_recent_transfers(const std::vector& args) { std::vector unconfirmed; std::vector recent; - m_wallet->get_recent_transfers_history(recent, 0, 0); + uint64_t total = 0; + m_wallet->get_recent_transfers_history(recent, 0, 0, total); m_wallet->get_unconfirmed_transfers(unconfirmed); //workaround for missed fee @@ -740,7 +741,8 @@ bool simple_wallet::list_recent_transfers_ex(const std::vector& arg { std::vector unconfirmed; std::vector recent; - m_wallet->get_recent_transfers_history(recent, 0, 0); + uint64_t total = 0; + m_wallet->get_recent_transfers_history(recent, 0, 0, total); m_wallet->get_unconfirmed_transfers(unconfirmed); //workaround for missed fee stringstream ss; From 77f5ac1cddfd06fa07b8b3c4606ce47cad723418 Mon Sep 17 00:00:00 2001 From: zano build machine Date: Mon, 2 Dec 2019 14:52:28 +0300 Subject: [PATCH 14/18] === build number: 71 -> 72 === --- src/version.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h.in b/src/version.h.in index bd46ad58..bdce3708 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -8,6 +8,6 @@ #define PROJECT_REVISION "4" #define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION -#define PROJECT_VERSION_BUILD_NO 71 +#define PROJECT_VERSION_BUILD_NO 72 #define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO) #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]" From 41a095dac9a638572cebc72f3cd638c9cdd2a6ca Mon Sep 17 00:00:00 2001 From: sowle Date: Mon, 2 Dec 2019 15:08:45 +0300 Subject: [PATCH 15/18] wallet: more verbose logging on storing --- src/wallet/wallet2.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index db30ba58..a69878e8 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2114,7 +2114,7 @@ void wallet2::store(const std::wstring& path_to_save, const std::string& passwor WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(!data_file.fail(), "failed to open binary wallet file for saving: " << tmp_file_path.string()); data_file << header_buff << keys_buff; - WLT_LOG_L0("Storing to " << tmp_file_path.string() << " ..."); + WLT_LOG_L0("Storing to temporary file " << tmp_file_path.string() << " ..."); r = tools::portble_serialize_obj_to_stream(*this, data_file); if (!r) @@ -2127,15 +2127,39 @@ void wallet2::store(const std::wstring& path_to_save, const std::string& passwor data_file.flush(); data_file.close(); + WLT_LOG_L1("Stored successfully to temporary file " << tmp_file_path.string()); + // for the sake of safety perform a double-renaming: wallet file -> old tmp, new tmp -> wallet file, remove old tmp boost::filesystem::path tmp_old_file_path = boost::filesystem::path(path_to_save); tmp_old_file_path += L".oldtmp_" + std::to_wstring(ts); if (boost::filesystem::is_regular_file(path_to_save)) + { boost::filesystem::rename(path_to_save, tmp_old_file_path); + WLT_LOG_L1("Renamed: " << ascii_path_to_save << " -> " << tmp_old_file_path.string()); + } + boost::filesystem::rename(tmp_file_path, path_to_save); - boost::filesystem::remove(tmp_old_file_path); + WLT_LOG_L1("Renamed: " << tmp_file_path.string() << " -> " << ascii_path_to_save); + + if (boost::filesystem::remove(tmp_old_file_path)) + { + WLT_LOG_L1("Removed temporary file: " << tmp_old_file_path.string()); + } + + bool path_to_save_exists = boost::filesystem::is_regular_file(path_to_save); + bool tmp_file_path_exists = boost::filesystem::is_regular_file(tmp_file_path); + bool tmp_old_file_path_exists = boost::filesystem::is_regular_file(tmp_old_file_path); + if (path_to_save_exists && !tmp_file_path_exists && !tmp_old_file_path_exists) + { + WLT_LOG_L0("Wallet was successfully stored to " << ascii_path_to_save); + } + else + { + WLT_LOG_ERROR("Wallet stroing to " << ascii_path_to_save << " might not be successfull: path_to_save_exists=" << path_to_save_exists << ", tmp_file_path_exists=" << tmp_file_path_exists << ", tmp_old_file_path_exists=" << tmp_old_file_path_exists); + throw tools::error::wallet_common_error(LOCATION_STR, "Wallet file storing might not be successfull. Please make sure you have backed up your seed phrase and check log for details."); + } } //---------------------------------------------------------------------------------------------------- void wallet2::store_watch_only(const std::wstring& path_to_save, const std::string& password) const From 6af5dca26c69f5ed6a20def5b813b98fc42f5aee Mon Sep 17 00:00:00 2001 From: sowle Date: Tue, 3 Dec 2019 21:18:03 +0300 Subject: [PATCH 16/18] currency_format_utils: added error check to lookup_acc_outs() --- src/currency_core/currency_format_utils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index d76c2768..1ab42769 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -1595,7 +1595,8 @@ namespace currency bool lookup_acc_outs(const account_keys& acc, const transaction& tx, const crypto::public_key& tx_pub_key, std::vector& outs, uint64_t& money_transfered, crypto::key_derivation& derivation) { money_transfered = 0; - generate_key_derivation(tx_pub_key, acc.m_view_secret_key, derivation); + bool r = generate_key_derivation(tx_pub_key, acc.m_view_secret_key, derivation); + CHECK_AND_ASSERT_MES(r, false, "unable to generate derivation from tx_pub = " << tx_pub_key << " * view_sec, invalid tx_pub?"); if (is_coinbase(tx) && get_block_height(tx) == 0 && tx_pub_key == ggenesis_tx_pub_key) { From 5e0addba760da416e0335dd0b1156cc790c1a108 Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 5 Dec 2019 02:25:41 +0300 Subject: [PATCH 17/18] simplewallet: typos fixed --- src/simplewallet/simplewallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index f6494f46..6b7150e6 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -1263,7 +1263,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: bool simple_wallet::show_seed(const std::vector &args) { success_msg_writer() << "Here's your wallet's seed phrase. Write it down and keep in a safe place."; - success_msg_writer(true) << "Anyone who knows the following 25 words can access you wallet:"; + success_msg_writer(true) << "Anyone who knows the following 25 words can access your wallet:"; std::cout << m_wallet->get_account().get_restore_braindata() << std::endl << std::flush; return true; } @@ -1271,7 +1271,7 @@ bool simple_wallet::show_seed(const std::vector &args) bool simple_wallet::spendkey(const std::vector &args) { message_writer(epee::log_space::console_color_red, true, std::string()) - << "WARNING! Anyone who knows the following secret key can access you wallet and spend your coins."; + << "WARNING! Anyone who knows the following secret key can access your wallet and spend your coins."; const account_keys& keys = m_wallet->get_account().get_keys(); std::cout << "secret: " << epee::string_tools::pod_to_hex(keys.m_spend_secret_key) << std::endl; @@ -1283,7 +1283,7 @@ bool simple_wallet::spendkey(const std::vector &args) bool simple_wallet::viewkey(const std::vector &args) { message_writer(epee::log_space::console_color_yellow, false, std::string()) - << "WARNING! Anyone who knows the following secret key can view you wallet (but can not spend your coins)."; + << "WARNING! Anyone who knows the following secret key can view your wallet (but can not spend your coins)."; const account_keys& keys = m_wallet->get_account().get_keys(); std::cout << "secret: " << epee::string_tools::pod_to_hex(keys.m_view_secret_key) << std::endl; From 407df8762e110fe443cb926a3c14882508d4d152 Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 5 Dec 2019 17:30:22 +0300 Subject: [PATCH 18/18] performance_tests : free space check improved --- tests/performance_tests/free_space_check.h | 22 ++++++++++------------ tests/performance_tests/main.cpp | 3 +++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/performance_tests/free_space_check.h b/tests/performance_tests/free_space_check.h index 9ab54e13..a4d4d21e 100644 --- a/tests/performance_tests/free_space_check.h +++ b/tests/performance_tests/free_space_check.h @@ -13,14 +13,14 @@ namespace fs = boost::filesystem; -std::string exec(const char* cmd) +std::string exec(const std::string& str) { std::array buffer; #if defined(WIN32) - std::unique_ptr pipe(_popen(cmd, "r"), _pclose); + std::unique_ptr pipe(_popen(str.c_str(), "r"), _pclose); #else - std::unique_ptr pipe(popen(cmd, "r"), pclose); + std::unique_ptr pipe(popen(str.c_str(), "r"), pclose); #endif if (!pipe) @@ -89,12 +89,13 @@ void free_space_check() bool r = false; #ifdef WIN32 - output = exec("dir"); + std::string command = "dir"; #else - output = exec("df -h"); + std::string command = "df -h && df -i"; #endif + output = exec(command); - LOG_PRINT_L0("test command output:" << std::endl << output); + LOG_PRINT_L0("test command " << command << ", output:" << std::endl << output); r = try_write_test_file(test_file_size); LOG_PRINT_L0("test file write: " << (r ? "OK" : "fail")); @@ -122,12 +123,9 @@ void free_space_check() } // free space is not ok! LOG_PRINT_YELLOW("1) fs::space() : available: " << si.available << ", free: " << si.free << ", capacity: " << si.capacity, LOG_LEVEL_0); -#ifdef WIN32 - output = exec("dir"); -#else - output = exec("df -h"); -#endif - LOG_PRINT_YELLOW(output, LOG_LEVEL_0); + + output = exec(command); + LOG_PRINT_YELLOW("executed command: " << command << ", output: " << std::endl << output, LOG_LEVEL_0); // try one again asap si = fs::space(current_path); diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp index 8c04a1bf..a490ad7b 100644 --- a/tests/performance_tests/main.cpp +++ b/tests/performance_tests/main.cpp @@ -27,6 +27,9 @@ int main(int argc, char** argv) epee::string_tools::set_module_name_and_folder(argv[0]); epee::log_space::get_set_log_detalisation_level(true, LOG_LEVEL_2); epee::log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL, LOG_LEVEL_2); + epee::log_space::log_singletone::add_logger(LOGGER_FILE, + epee::log_space::log_singletone::get_default_log_file().c_str(), + epee::log_space::log_singletone::get_default_log_folder().c_str()); //run_serialization_performance_test(); //return 1;