From 4dd659a62eb553b3b11b69aeb268115326819984 Mon Sep 17 00:00:00 2001 From: cyan Date: Thu, 25 Jul 2024 20:59:18 +0000 Subject: [PATCH] update patches for v0.18.3.4 --- apply_patches.sh | 2 +- patches/monero/0001-polyseed.patch | 78 ++--- ...ckground-sync-with-just-the-view-key.patch | 303 +++++++++--------- patches/monero/0003-airgap.patch | 16 +- patches/monero/0004-coin-control.patch | 63 ++-- patches/monero/0005-fix-build-issues.patch | 6 +- patches/monero/0006-macos-build-fix.patch | 23 +- .../0007-fix-make-debug-test-target.patch | 61 ++-- ...g-___clear_cache-when-targetting-iOS.patch | 6 +- ...coverDeterministicWalletFromSpendKey.patch | 8 +- ...-and-tx-key-getter-for-PendingTransc.patch | 6 +- patches/monero/0011-store-crash-fix.patch | 24 +- patches/monero/0012-WIP-UR-functions.patch | 14 +- .../0013-android-ndk-version-bump.patch | 4 +- ...v7a.patch => 0014-rename-arm-armv7a.patch} | 4 +- ...e-proper-error-handling-in-get_seed.patch} | 8 +- ...=> 0016-add-dummy-device-for-ledger.patch} | 8 +- patches/monero/0017-added-deps.patch | 29 ++ 18 files changed, 309 insertions(+), 354 deletions(-) rename patches/monero/{0013-rename-arm-armv7a.patch => 0014-rename-arm-armv7a.patch} (97%) rename patches/monero/{0014-use-proper-error-handling-in-get_seed.patch => 0015-use-proper-error-handling-in-get_seed.patch} (92%) rename patches/monero/{0015-add-dummy-device-for-ledger.patch => 0016-add-dummy-device-for-ledger.patch} (98%) create mode 100644 patches/monero/0017-added-deps.patch diff --git a/apply_patches.sh b/apply_patches.sh index e8e090e..59dc988 100755 --- a/apply_patches.sh +++ b/apply_patches.sh @@ -28,7 +28,7 @@ fi set -e cd $repo -git am -3 ../patches/$repo/*.patch +git am -3 --whitespace=fix --reject ../patches/$repo/*.patch if [[ "$repo" == "wownero" ]]; then pushd external/randomwow diff --git a/patches/monero/0001-polyseed.patch b/patches/monero/0001-polyseed.patch index 2db45e5..8164403 100644 --- a/patches/monero/0001-polyseed.patch +++ b/patches/monero/0001-polyseed.patch @@ -1,18 +1,15 @@ -From b9fac308d903e9dd79b95d6db73c37807e1219b7 Mon Sep 17 00:00:00 2001 +From 8324040dfb89bd90b414ea685b2aa758a461fbc4 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 12 Mar 2024 09:42:37 +0100 -Subject: [PATCH 01/10] polyseed +Subject: [PATCH 01/16] polyseed Co-authored-by: Czarek Nakamoto --- - .github/workflows/build.yml | 4 +- .gitmodules | 6 + CMakeLists.txt | 4 +- contrib/epee/include/wipeable_string.h | 7 + contrib/epee/src/wipeable_string.cpp | 10 ++ external/CMakeLists.txt | 2 + - external/polyseed | 1 + - external/utf8proc | 1 + src/CMakeLists.txt | 1 + src/cryptonote_basic/CMakeLists.txt | 1 + src/cryptonote_basic/account.cpp | 23 +++- @@ -30,30 +27,13 @@ Co-authored-by: Czarek Nakamoto src/wallet/api/wallet_manager.h | 10 ++ src/wallet/wallet2.cpp | 102 ++++++++++++-- src/wallet/wallet2.h | 30 +++- - 25 files changed, 809 insertions(+), 21 deletions(-) - create mode 160000 external/polyseed - create mode 160000 external/utf8proc + 22 files changed, 805 insertions(+), 19 deletions(-) create mode 100644 src/polyseed/CMakeLists.txt create mode 100644 src/polyseed/pbkdf2.c create mode 100644 src/polyseed/pbkdf2.h create mode 100644 src/polyseed/polyseed.cpp create mode 100644 src/polyseed/polyseed.hpp -diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml -index 4c1e381c0..70bea03b3 100644 ---- a/.github/workflows/build.yml -+++ b/.github/workflows/build.yml -@@ -124,8 +124,8 @@ jobs: - - name: build - run: | - ${{env.CCACHE_SETTINGS}} -- cmake . -- make wallet_api -j3 -+ cmake -S . -B build -+ cmake --build build wallet_api -j3 - - test-ubuntu: - needs: build-ubuntu diff --git a/.gitmodules b/.gitmodules index 721cce3b4..73a23fb35 100644 --- a/.gitmodules @@ -148,20 +128,6 @@ index 5b7f69a56..1b9761d70 100644 +add_subdirectory(polyseed EXCLUDE_FROM_ALL) +add_subdirectory(utf8proc EXCLUDE_FROM_ALL) \ No newline at end of file -diff --git a/external/polyseed b/external/polyseed -new file mode 160000 -index 000000000..9d4f1a032 ---- /dev/null -+++ b/external/polyseed -@@ -0,0 +1 @@ -+Subproject commit 9d4f1a032585656e1a642ee70cdf929001badba6 -diff --git a/external/utf8proc b/external/utf8proc -new file mode 160000 -index 000000000..1cb28a66c ---- /dev/null -+++ b/external/utf8proc -@@ -0,0 +1 @@ -+Subproject commit 1cb28a66ca79a0845e99433fd1056257456cef8b diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3335d3c21..06b708cf0 100644 --- a/src/CMakeLists.txt @@ -468,7 +434,7 @@ index 000000000..f6253b9d7 \ No newline at end of file diff --git a/src/polyseed/polyseed.cpp b/src/polyseed/polyseed.cpp new file mode 100644 -index 000000000..0a8852777 +index 000000000..231a48a94 --- /dev/null +++ b/src/polyseed/polyseed.cpp @@ -0,0 +1,182 @@ @@ -520,7 +486,7 @@ index 000000000..0a8852777 + if (result < 0 || result > (POLYSEED_STR_SIZE - 1)) { + throw std::runtime_error("Unicode normalization failed"); + } -+ ++ + result = utf8proc_reencode(buffer, result, options); + if (result < 0 || result > POLYSEED_STR_SIZE) { + throw std::runtime_error("Unicode normalization failed"); @@ -829,7 +795,7 @@ index 000000000..2c8c777a7 +#endif //POLYSEED_HPP \ No newline at end of file diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 8d7364cba..472f05016 100644 +index fc4f89128..d96ea97ea 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -690,6 +690,28 @@ bool WalletImpl::recoverFromDevice(const std::string &path, const std::string &p @@ -876,7 +842,7 @@ index 8d7364cba..472f05016 100644 + } + + bool result = m_wallet->get_polyseed(seed_words_epee, passphrase_epee); -+ ++ + seed_words.assign(seed_words_epee.data(), seed_words_epee.size()); + passphrase.assign(passphrase_epee.data(), passphrase_epee.size()); + @@ -898,7 +864,7 @@ index 8d7364cba..472f05016 100644 +bool Wallet::createPolyseed(std::string &seed_words, std::string &err, const std::string &language) +{ + epee::wipeable_string seed_words_epee(seed_words.c_str(), seed_words.size()); -+ ++ + try { + polyseed::data polyseed(POLYSEED_COIN); + polyseed.create(0); @@ -1026,7 +992,7 @@ index a223e1df9..28fcd36c9 100644 bool walletExists(const std::string &path) override; bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds = 1) const override; diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index f34b10988..e4e02c782 100644 +index 64f486e71..9e95f44d6 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -92,6 +92,7 @@ using namespace epee; @@ -1074,7 +1040,7 @@ index f34b10988..e4e02c782 100644 return true; } //---------------------------------------------------------------------------------------------------- -@@ -4629,6 +4646,9 @@ boost::optional wallet2::get_keys_file_data(const epee: +@@ -4630,6 +4647,9 @@ boost::optional wallet2::get_keys_file_data(const epee: value2.SetInt(m_enable_multisig ? 1 : 0); json.AddMember("enable_multisig", value2, json.GetAllocator()); @@ -1084,7 +1050,7 @@ index f34b10988..e4e02c782 100644 // Serialize the JSON object rapidjson::StringBuffer buffer; rapidjson::Writer writer(buffer); -@@ -4776,6 +4796,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -4777,6 +4797,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st m_credits_target = 0; m_enable_multisig = false; m_allow_mismatched_daemon_version = false; @@ -1092,7 +1058,7 @@ index f34b10988..e4e02c782 100644 } else if(json.IsObject()) { -@@ -5012,6 +5033,8 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -5013,6 +5034,8 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st m_credits_target = field_credits_target; GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, enable_multisig, int, Int, false, false); m_enable_multisig = field_enable_multisig; @@ -1101,7 +1067,7 @@ index f34b10988..e4e02c782 100644 } else { -@@ -5284,6 +5307,48 @@ void wallet2::init_type(hw::device::device_type device_type) +@@ -5285,6 +5308,48 @@ void wallet2::init_type(hw::device::device_type device_type) m_key_device_type = device_type; } @@ -1150,7 +1116,7 @@ index f34b10988..e4e02c782 100644 /*! * \brief Generates a wallet or restores one. Assumes the multisig setup * has already completed for the provided multisig info. -@@ -5411,7 +5476,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip +@@ -5412,7 +5477,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip return retval; } @@ -1159,7 +1125,7 @@ index f34b10988..e4e02c782 100644 { // -1 month for fluctuations in block time and machine date/time setup. // avg seconds per block -@@ -5435,7 +5500,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip +@@ -5436,7 +5501,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip // the daemon is currently syncing. // If we use the approximate height we subtract one month as // a safety margin. @@ -1168,7 +1134,7 @@ index f34b10988..e4e02c782 100644 uint64_t target_height = get_daemon_blockchain_target_height(err); if (err.empty()) { if (target_height < height) -@@ -13135,7 +13200,7 @@ uint64_t wallet2::get_daemon_blockchain_target_height(string &err) +@@ -13133,7 +13198,7 @@ uint64_t wallet2::get_daemon_blockchain_target_height(string &err) return target_height; } @@ -1177,16 +1143,16 @@ index f34b10988..e4e02c782 100644 { // time of v2 fork const time_t fork_time = m_nettype == TESTNET ? 1448285909 : m_nettype == STAGENET ? 1520937818 : 1458748658; -@@ -13144,7 +13209,7 @@ uint64_t wallet2::get_approximate_blockchain_height() const +@@ -13142,7 +13207,7 @@ uint64_t wallet2::get_approximate_blockchain_height() const // avg seconds per block const int seconds_per_block = DIFFICULTY_TARGET_V2; // Calculated blockchain height - uint64_t approx_blockchain_height = fork_block + (time(NULL) - fork_time)/seconds_per_block; + uint64_t approx_blockchain_height = fork_block + ((t > 0 ? t : time(NULL)) - fork_time)/seconds_per_block; // testnet and stagenet got some huge rollbacks, so the estimation is way off - static const uint64_t approximate_rolled_back_blocks = m_nettype == TESTNET ? 342100 : 30000; + static const uint64_t approximate_rolled_back_blocks = m_nettype == TESTNET ? 342100 : m_nettype == STAGENET ? 60000 : 30000; if ((m_nettype == TESTNET || m_nettype == STAGENET) && approx_blockchain_height > approximate_rolled_back_blocks) -@@ -14862,15 +14927,6 @@ bool wallet2::parse_uri(const std::string &uri, std::string &address, std::strin +@@ -14860,15 +14925,6 @@ bool wallet2::parse_uri(const std::string &uri, std::string &address, std::strin //---------------------------------------------------------------------------------------------------- uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day) { @@ -1202,7 +1168,7 @@ index f34b10988..e4e02c782 100644 std::tm date = { 0, 0, 0, 0, 0, 0, 0, 0 }; date.tm_year = year - 1900; date.tm_mon = month - 1; -@@ -14879,7 +14935,23 @@ uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, ui +@@ -14877,7 +14933,23 @@ uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, ui { throw std::runtime_error("month or day out of range"); } @@ -1227,7 +1193,7 @@ index f34b10988..e4e02c782 100644 uint64_t height_min = 0; uint64_t height_max = get_daemon_blockchain_height(err) - 1; diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index 3144a8fd3..b540eff6b 100644 +index c38d77675..91ec72e0f 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -72,6 +72,7 @@ @@ -1303,5 +1269,5 @@ index 3144a8fd3..b540eff6b 100644 uint32_t m_multisig_threshold; std::vector m_multisig_signers; -- -2.44.0 +2.39.2 diff --git a/patches/monero/0002-wallet-background-sync-with-just-the-view-key.patch b/patches/monero/0002-wallet-background-sync-with-just-the-view-key.patch index f5d87b6..16fe77f 100644 --- a/patches/monero/0002-wallet-background-sync-with-just-the-view-key.patch +++ b/patches/monero/0002-wallet-background-sync-with-just-the-view-key.patch @@ -1,7 +1,7 @@ -From f1cf1d2378a5bb6313eef9a58325b03cb4ac0f85 Mon Sep 17 00:00:00 2001 +From 56fed429a25773c760b8490b3e0fb908c832e6e5 Mon Sep 17 00:00:00 2001 From: j-berman Date: Thu, 13 Oct 2022 18:33:33 -0700 -Subject: [PATCH 02/10] wallet: background sync with just the view key +Subject: [PATCH 02/16] wallet: background sync with just the view key - When background syncing, the wallet wipes the spend key from memory and processes all new transactions. The wallet saves @@ -30,7 +30,7 @@ cache. src/cryptonote_basic/account.cpp | 11 + src/cryptonote_basic/account.h | 1 + src/cryptonote_config.h | 2 + - src/simplewallet/simplewallet.cpp | 205 +++- + src/simplewallet/simplewallet.cpp | 203 +++- src/simplewallet/simplewallet.h | 1 + src/wallet/api/wallet.cpp | 213 +++- src/wallet/api/wallet.h | 12 + @@ -47,7 +47,7 @@ cache. tests/functional_tests/wallet.py | 43 +- tests/unit_tests/wipeable_string.cpp | 12 + utils/python-rpc/framework/wallet.py | 42 + - 20 files changed, 2337 insertions(+), 130 deletions(-) + 20 files changed, 2335 insertions(+), 130 deletions(-) diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp index 4931c3740..2d556f285 100644 @@ -97,7 +97,7 @@ index 8e1a07110..3af3a63a1 100644 const unsigned char HASH_KEY_MEMORY = 'k'; const unsigned char HASH_KEY_MULTISIG[] = {'M', 'u', 'l', 't' , 'i', 's', 'i', 'g', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp -index f2eaf6b13..341b0e448 100644 +index b9e30f9d9..f8ed6659c 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -155,6 +155,17 @@ typedef cryptonote::simple_wallet sw; @@ -115,10 +115,10 @@ index f2eaf6b13..341b0e448 100644 + } \ + } while (0) + - enum TransferType { - Transfer, - TransferLocked, -@@ -332,7 +343,7 @@ namespace + static std::string get_human_readable_timespan(std::chrono::seconds seconds); + static std::string get_human_readable_timespan(uint64_t seconds); + +@@ -325,7 +336,7 @@ namespace auto pwd_container = tools::password_container::prompt(verify, prompt); if (!pwd_container) { @@ -127,7 +127,7 @@ index f2eaf6b13..341b0e448 100644 } return pwd_container; } -@@ -342,6 +353,11 @@ namespace +@@ -335,6 +346,11 @@ namespace return password_prompter(verify ? sw::tr("Enter a new password for the wallet") : sw::tr("Wallet password"), verify); } @@ -139,7 +139,7 @@ index f2eaf6b13..341b0e448 100644 inline std::string interpret_rpc_response(bool ok, const std::string& status) { std::string err; -@@ -459,6 +475,41 @@ namespace +@@ -452,6 +468,41 @@ namespace return "invalid"; } @@ -181,7 +181,7 @@ index f2eaf6b13..341b0e448 100644 std::string get_version_string(uint32_t version) { return boost::lexical_cast(version >> 16) + "." + boost::lexical_cast(version & 0xffff); -@@ -812,6 +863,7 @@ bool simple_wallet::spendkey(const std::vector &args/* = std::vecto +@@ -805,6 +856,7 @@ bool simple_wallet::spendkey(const std::vector &args/* = std::vecto fail_msg_writer() << tr("wallet is watch-only and has no spend key"); return true; } @@ -189,7 +189,7 @@ index f2eaf6b13..341b0e448 100644 // don't log PAUSE_READLINE(); if (m_wallet->key_on_device()) { -@@ -843,6 +895,7 @@ bool simple_wallet::print_seed(bool encrypted) +@@ -836,6 +888,7 @@ bool simple_wallet::print_seed(bool encrypted) fail_msg_writer() << tr("wallet is watch-only and has no seed"); return true; } @@ -197,7 +197,7 @@ index f2eaf6b13..341b0e448 100644 multisig = m_wallet->multisig(&ready); if (multisig) -@@ -920,6 +973,7 @@ bool simple_wallet::seed_set_language(const std::vector &args/* = s +@@ -913,6 +966,7 @@ bool simple_wallet::seed_set_language(const std::vector &args/* = s fail_msg_writer() << tr("wallet is watch-only and has no seed"); return true; } @@ -205,7 +205,7 @@ index f2eaf6b13..341b0e448 100644 epee::wipeable_string password; { -@@ -1066,6 +1120,7 @@ bool simple_wallet::prepare_multisig_main(const std::vector &args, +@@ -1059,6 +1113,7 @@ bool simple_wallet::prepare_multisig_main(const std::vector &args, fail_msg_writer() << tr("wallet is watch-only and cannot be made multisig"); return false; } @@ -213,7 +213,7 @@ index f2eaf6b13..341b0e448 100644 if(m_wallet->get_num_transfer_details()) { -@@ -2202,6 +2257,7 @@ bool simple_wallet::save_known_rings(const std::vector &args) +@@ -2195,6 +2250,7 @@ bool simple_wallet::save_known_rings(const std::vector &args) bool simple_wallet::freeze_thaw(const std::vector &args, bool freeze) { @@ -221,7 +221,7 @@ index f2eaf6b13..341b0e448 100644 if (args.empty()) { fail_msg_writer() << boost::format(tr("usage: %s |")) % (freeze ? "freeze" : "thaw"); -@@ -2241,6 +2297,7 @@ bool simple_wallet::thaw(const std::vector &args) +@@ -2234,6 +2290,7 @@ bool simple_wallet::thaw(const std::vector &args) bool simple_wallet::frozen(const std::vector &args) { @@ -229,7 +229,7 @@ index f2eaf6b13..341b0e448 100644 if (args.empty()) { size_t ntd = m_wallet->get_num_transfer_details(); -@@ -3012,6 +3069,56 @@ bool simple_wallet::set_track_uses(const std::vector &args/* = std: +@@ -3005,6 +3062,56 @@ bool simple_wallet::set_track_uses(const std::vector &args/* = std: return true; } @@ -286,7 +286,7 @@ index f2eaf6b13..341b0e448 100644 bool simple_wallet::set_show_wallet_name_when_locked(const std::vector &args/* = std::vector()*/) { const auto pwd_container = get_and_verify_password(); -@@ -3244,6 +3351,7 @@ bool simple_wallet::apropos(const std::vector &args) +@@ -3237,6 +3344,7 @@ bool simple_wallet::apropos(const std::vector &args) bool simple_wallet::scan_tx(const std::vector &args) { @@ -294,7 +294,7 @@ index f2eaf6b13..341b0e448 100644 if (args.empty()) { PRINT_USAGE(USAGE_SCAN_TX); -@@ -3473,6 +3581,8 @@ simple_wallet::simple_wallet() +@@ -3458,6 +3566,8 @@ simple_wallet::simple_wallet() " Ignore outputs of amount below this threshold when spending.\n " "track-uses <1|0>\n " " Whether to keep track of owned outputs uses.\n " @@ -303,7 +303,7 @@ index f2eaf6b13..341b0e448 100644 "setup-background-mining <1|0>\n " " Whether to enable background mining. Set this to support the network and to get a chance to receive new monero.\n " "device-name \n " -@@ -3891,6 +4001,7 @@ bool simple_wallet::set_variable(const std::vector &args) +@@ -3876,6 +3986,7 @@ bool simple_wallet::set_variable(const std::vector &args) success_msg_writer() << "ignore-outputs-above = " << cryptonote::print_money(m_wallet->ignore_outputs_above()); success_msg_writer() << "ignore-outputs-below = " << cryptonote::print_money(m_wallet->ignore_outputs_below()); success_msg_writer() << "track-uses = " << m_wallet->track_uses(); @@ -311,7 +311,7 @@ index f2eaf6b13..341b0e448 100644 success_msg_writer() << "setup-background-mining = " << setup_background_mining_string; success_msg_writer() << "device-name = " << m_wallet->device_name(); success_msg_writer() << "export-format = " << (m_wallet->export_format() == tools::wallet2::ExportFormat::Ascii ? "ascii" : "binary"); -@@ -3909,6 +4020,7 @@ bool simple_wallet::set_variable(const std::vector &args) +@@ -3894,6 +4005,7 @@ bool simple_wallet::set_variable(const std::vector &args) } else { @@ -319,7 +319,7 @@ index f2eaf6b13..341b0e448 100644 #define CHECK_SIMPLE_VARIABLE(name, f, help) do \ if (args[0] == name) { \ -@@ -3962,6 +4074,7 @@ bool simple_wallet::set_variable(const std::vector &args) +@@ -3947,6 +4059,7 @@ bool simple_wallet::set_variable(const std::vector &args) CHECK_SIMPLE_VARIABLE("ignore-outputs-above", set_ignore_outputs_above, tr("amount")); CHECK_SIMPLE_VARIABLE("ignore-outputs-below", set_ignore_outputs_below, tr("amount")); CHECK_SIMPLE_VARIABLE("track-uses", set_track_uses, tr("0 or 1")); @@ -327,7 +327,7 @@ index f2eaf6b13..341b0e448 100644 CHECK_SIMPLE_VARIABLE("show-wallet-name-when-locked", set_show_wallet_name_when_locked, tr("1 or 0")); CHECK_SIMPLE_VARIABLE("inactivity-lock-timeout", set_inactivity_lock_timeout, tr("unsigned integer (seconds, 0 to disable)")); CHECK_SIMPLE_VARIABLE("setup-background-mining", set_setup_background_mining, tr("1/yes or 0/no")); -@@ -4915,7 +5028,10 @@ std::string simple_wallet::get_mnemonic_language() +@@ -4900,7 +5013,10 @@ std::string simple_wallet::get_mnemonic_language() //---------------------------------------------------------------------------------------------------- boost::optional simple_wallet::get_and_verify_password() const { @@ -339,7 +339,7 @@ index f2eaf6b13..341b0e448 100644 if (!pwd_container) return boost::none; -@@ -5218,6 +5334,8 @@ boost::optional simple_wallet::open_wallet(const boost::p +@@ -5203,6 +5319,8 @@ boost::optional simple_wallet::open_wallet(const boost::p prefix = tr("Opened watch-only wallet"); else if (m_wallet->multisig(&ready, &threshold, &total)) prefix = (boost::format(tr("Opened %u/%u multisig wallet%s")) % threshold % total % (ready ? "" : " (not yet finalized)")).str(); @@ -348,7 +348,7 @@ index f2eaf6b13..341b0e448 100644 else prefix = tr("Opened wallet"); message_writer(console_color_white, true) << -@@ -5426,6 +5544,10 @@ void simple_wallet::stop_background_mining() +@@ -5411,6 +5529,10 @@ void simple_wallet::stop_background_mining() //---------------------------------------------------------------------------------------------------- void simple_wallet::check_background_mining(const epee::wipeable_string &password) { @@ -359,7 +359,7 @@ index f2eaf6b13..341b0e448 100644 tools::wallet2::BackgroundMiningSetupType setup = m_wallet->setup_background_mining(); if (setup == tools::wallet2::BackgroundMiningNo) { -@@ -6290,6 +6412,7 @@ bool simple_wallet::show_blockchain_height(const std::vector& args) +@@ -6275,6 +6397,7 @@ bool simple_wallet::show_blockchain_height(const std::vector& args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::rescan_spent(const std::vector &args) { @@ -367,7 +367,7 @@ index f2eaf6b13..341b0e448 100644 if (!m_wallet->is_trusted_daemon()) { fail_msg_writer() << tr("this command requires a trusted daemon. Enable with --trusted-daemon"); -@@ -6547,10 +6670,27 @@ void simple_wallet::check_for_inactivity_lock(bool user) +@@ -6532,10 +6655,27 @@ void simple_wallet::check_for_inactivity_lock(bool user) " || ||" << std::endl << "" << std::endl; } @@ -396,7 +396,7 @@ index f2eaf6b13..341b0e448 100644 const bool show_wallet_name = m_wallet->show_wallet_name_when_locked(); if (show_wallet_name) -@@ -6563,8 +6703,16 @@ void simple_wallet::check_for_inactivity_lock(bool user) +@@ -6548,8 +6688,16 @@ void simple_wallet::check_for_inactivity_lock(bool user) } try { @@ -414,15 +414,15 @@ index f2eaf6b13..341b0e448 100644 } catch (...) { /* do nothing, just let the loop loop */ } } -@@ -6591,6 +6739,7 @@ bool simple_wallet::on_command(bool (simple_wallet::*cmd)(const std::vector &args_, bool called_by_mms) +@@ -6576,6 +6724,7 @@ bool simple_wallet::on_command(bool (simple_wallet::*cmd)(const std::vector &args_, bool called_by_mms) { // "transfer [index=[,,...]] [] []
[]" + CHECK_IF_BACKGROUND_SYNCING("cannot transfer"); if (!try_connect_to_daemon()) return false; -@@ -7064,6 +7213,7 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector &args_, bool ca //---------------------------------------------------------------------------------------------------- bool simple_wallet::transfer(const std::vector &args_) { @@ -430,23 +430,7 @@ index f2eaf6b13..341b0e448 100644 if (args_.size() < 1) { PRINT_USAGE(USAGE_TRANSFER); -@@ -7075,6 +7225,7 @@ bool simple_wallet::transfer(const std::vector &args_) - //---------------------------------------------------------------------------------------------------- - bool simple_wallet::locked_transfer(const std::vector &args_) - { -+ CHECK_IF_BACKGROUND_SYNCING("cannot transfer"); - if (args_.size() < 1) - { - PRINT_USAGE(USAGE_LOCKED_TRANSFER); -@@ -7086,6 +7237,7 @@ bool simple_wallet::locked_transfer(const std::vector &args_) - //---------------------------------------------------------------------------------------------------- - bool simple_wallet::locked_sweep_all(const std::vector &args_) - { -+ CHECK_IF_BACKGROUND_SYNCING("cannot sweep"); - if (args_.size() < 1) - { - PRINT_USAGE(USAGE_LOCKED_SWEEP_ALL); -@@ -7098,6 +7250,7 @@ bool simple_wallet::locked_sweep_all(const std::vector &args_) +@@ -7016,6 +7166,7 @@ bool simple_wallet::transfer(const std::vector &args_) bool simple_wallet::sweep_unmixable(const std::vector &args_) { @@ -454,15 +438,15 @@ index f2eaf6b13..341b0e448 100644 if (!try_connect_to_daemon()) return true; -@@ -7205,6 +7358,7 @@ bool simple_wallet::sweep_unmixable(const std::vector &args_) +@@ -7123,6 +7274,7 @@ bool simple_wallet::sweep_unmixable(const std::vector &args_) //---------------------------------------------------------------------------------------------------- - bool simple_wallet::sweep_main(uint32_t account, uint64_t below, bool locked, const std::vector &args_) + bool simple_wallet::sweep_main(uint32_t account, uint64_t below, const std::vector &args_) { + CHECK_IF_BACKGROUND_SYNCING("cannot sweep"); auto print_usage = [this, account, below]() { if (below) -@@ -7521,6 +7675,7 @@ bool simple_wallet::sweep_main(uint32_t account, uint64_t below, bool locked, co +@@ -7404,6 +7556,7 @@ bool simple_wallet::sweep_main(uint32_t account, uint64_t below, const std::vect //---------------------------------------------------------------------------------------------------- bool simple_wallet::sweep_single(const std::vector &args_) { @@ -470,12 +454,12 @@ index f2eaf6b13..341b0e448 100644 if (!try_connect_to_daemon()) return true; -@@ -7759,12 +7914,14 @@ bool simple_wallet::sweep_single(const std::vector &args_) +@@ -7642,12 +7795,14 @@ bool simple_wallet::sweep_single(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::sweep_all(const std::vector &args_) { + CHECK_IF_BACKGROUND_SYNCING("cannot sweep"); - sweep_main(m_current_subaddress_account, 0, false, args_); + sweep_main(m_current_subaddress_account, 0, args_); return true; } //---------------------------------------------------------------------------------------------------- @@ -485,7 +469,7 @@ index f2eaf6b13..341b0e448 100644 auto local_args = args_; if (local_args.empty()) { -@@ -7785,6 +7942,7 @@ bool simple_wallet::sweep_account(const std::vector &args_) +@@ -7668,6 +7823,7 @@ bool simple_wallet::sweep_account(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::sweep_below(const std::vector &args_) { @@ -493,7 +477,7 @@ index f2eaf6b13..341b0e448 100644 uint64_t below = 0; if (args_.size() < 1) { -@@ -7803,6 +7961,7 @@ bool simple_wallet::sweep_below(const std::vector &args_) +@@ -7686,6 +7842,7 @@ bool simple_wallet::sweep_below(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::donate(const std::vector &args_) { @@ -501,7 +485,7 @@ index f2eaf6b13..341b0e448 100644 std::vector local_args = args_; if(local_args.empty() || local_args.size() > 5) { -@@ -7864,6 +8023,7 @@ bool simple_wallet::donate(const std::vector &args_) +@@ -7747,6 +7904,7 @@ bool simple_wallet::donate(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::accept_loaded_tx(const std::function get_num_txes, const std::function &get_tx, const std::string &extra_message) { @@ -509,7 +493,7 @@ index f2eaf6b13..341b0e448 100644 // gather info to ask the user uint64_t amount = 0, amount_to_dests = 0, change = 0; size_t min_ring_size = ~0; -@@ -8044,6 +8204,7 @@ bool simple_wallet::sign_transfer(const std::vector &args_) +@@ -7927,6 +8085,7 @@ bool simple_wallet::sign_transfer(const std::vector &args_) fail_msg_writer() << tr("This is a watch only wallet"); return true; } @@ -517,7 +501,7 @@ index f2eaf6b13..341b0e448 100644 bool export_raw = false; std::string unsigned_filename = "unsigned_monero_tx"; -@@ -8151,6 +8312,8 @@ std::string get_tx_key_stream(crypto::secret_key tx_key, std::vector &args_) { @@ -526,7 +510,7 @@ index f2eaf6b13..341b0e448 100644 std::vector local_args = args_; if (m_wallet->key_on_device() && m_wallet->get_account().get_device().get_type() != hw::device::TREZOR) -@@ -8191,6 +8354,8 @@ bool simple_wallet::get_tx_key(const std::vector &args_) +@@ -8074,6 +8235,8 @@ bool simple_wallet::get_tx_key(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::set_tx_key(const std::vector &args_) { @@ -535,7 +519,7 @@ index f2eaf6b13..341b0e448 100644 std::vector local_args = args_; if(local_args.size() != 2 && local_args.size() != 3) { -@@ -8267,6 +8432,8 @@ bool simple_wallet::set_tx_key(const std::vector &args_) +@@ -8150,6 +8313,8 @@ bool simple_wallet::set_tx_key(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_tx_proof(const std::vector &args) { @@ -544,7 +528,7 @@ index f2eaf6b13..341b0e448 100644 if (args.size() != 2 && args.size() != 3) { PRINT_USAGE(USAGE_GET_TX_PROOF); -@@ -8473,6 +8640,7 @@ bool simple_wallet::check_tx_proof(const std::vector &args) +@@ -8356,6 +8521,7 @@ bool simple_wallet::check_tx_proof(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_spend_proof(const std::vector &args) { @@ -552,7 +536,7 @@ index f2eaf6b13..341b0e448 100644 if (m_wallet->key_on_device()) { fail_msg_writer() << tr("command not supported by HW wallet"); -@@ -8557,6 +8725,7 @@ bool simple_wallet::check_spend_proof(const std::vector &args) +@@ -8440,6 +8606,7 @@ bool simple_wallet::check_spend_proof(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_reserve_proof(const std::vector &args) { @@ -560,7 +544,7 @@ index f2eaf6b13..341b0e448 100644 if (m_wallet->key_on_device()) { fail_msg_writer() << tr("command not supported by HW wallet"); -@@ -9243,6 +9412,8 @@ bool simple_wallet::unspent_outputs(const std::vector &args_) +@@ -9126,6 +9293,8 @@ bool simple_wallet::unspent_outputs(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::rescan_blockchain(const std::vector &args_) { @@ -569,7 +553,7 @@ index f2eaf6b13..341b0e448 100644 uint64_t start_height = 0; ResetType reset_type = ResetSoft; -@@ -9540,6 +9711,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9423,6 +9592,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector if (command == "new") { // create a new account and switch to it @@ -577,7 +561,7 @@ index f2eaf6b13..341b0e448 100644 std::string label = boost::join(local_args, " "); if (label.empty()) label = tr("(Untitled account)"); -@@ -9570,6 +9742,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9453,6 +9623,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector else if (command == "label" && local_args.size() >= 1) { // set label of the specified account @@ -585,7 +569,7 @@ index f2eaf6b13..341b0e448 100644 uint32_t index_major; if (!epee::string_tools::get_xtype_from_string(index_major, local_args[0])) { -@@ -9591,6 +9764,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9474,6 +9645,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector } else if (command == "tag" && local_args.size() >= 2) { @@ -593,7 +577,7 @@ index f2eaf6b13..341b0e448 100644 const std::string tag = local_args[0]; std::set account_indices; for (size_t i = 1; i < local_args.size(); ++i) -@@ -9615,6 +9789,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9498,6 +9670,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector } else if (command == "untag" && local_args.size() >= 1) { @@ -601,7 +585,7 @@ index f2eaf6b13..341b0e448 100644 std::set account_indices; for (size_t i = 0; i < local_args.size(); ++i) { -@@ -9638,6 +9813,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9521,6 +9694,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector } else if (command == "tag_description" && local_args.size() >= 1) { @@ -609,7 +593,7 @@ index f2eaf6b13..341b0e448 100644 const std::string tag = local_args[0]; std::string description; if (local_args.size() > 1) -@@ -9755,6 +9931,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: +@@ -9638,6 +9812,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: } else if (local_args[0] == "new") { @@ -617,7 +601,7 @@ index f2eaf6b13..341b0e448 100644 local_args.erase(local_args.begin()); std::string label; if (local_args.size() > 0) -@@ -9767,6 +9944,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: +@@ -9650,6 +9825,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: } else if (local_args[0] == "mnew") { @@ -625,7 +609,7 @@ index f2eaf6b13..341b0e448 100644 local_args.erase(local_args.begin()); if (local_args.size() != 1) { -@@ -9792,6 +9970,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: +@@ -9675,6 +9851,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: } else if (local_args[0] == "one-off") { @@ -633,7 +617,7 @@ index f2eaf6b13..341b0e448 100644 local_args.erase(local_args.begin()); std::string label; if (local_args.size() != 2) -@@ -9810,6 +9989,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: +@@ -9693,6 +9870,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: } else if (local_args.size() >= 2 && local_args[0] == "label") { @@ -641,7 +625,7 @@ index f2eaf6b13..341b0e448 100644 if (!epee::string_tools::get_xtype_from_string(index, local_args[1])) { fail_msg_writer() << tr("failed to parse index: ") << local_args[1]; -@@ -9956,6 +10136,8 @@ bool simple_wallet::print_integrated_address(const std::vector &arg +@@ -9839,6 +10017,8 @@ bool simple_wallet::print_integrated_address(const std::vector &arg //---------------------------------------------------------------------------------------------------- bool simple_wallet::address_book(const std::vector &args/* = std::vector()*/) { @@ -650,7 +634,7 @@ index f2eaf6b13..341b0e448 100644 if (args.size() == 0) { } -@@ -10016,6 +10198,8 @@ bool simple_wallet::address_book(const std::vector &args/* = std::v +@@ -9899,6 +10079,8 @@ bool simple_wallet::address_book(const std::vector &args/* = std::v //---------------------------------------------------------------------------------------------------- bool simple_wallet::set_tx_note(const std::vector &args) { @@ -659,7 +643,7 @@ index f2eaf6b13..341b0e448 100644 if (args.size() == 0) { PRINT_USAGE(USAGE_SET_TX_NOTE); -@@ -10044,6 +10228,8 @@ bool simple_wallet::set_tx_note(const std::vector &args) +@@ -9927,6 +10109,8 @@ bool simple_wallet::set_tx_note(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_tx_note(const std::vector &args) { @@ -668,7 +652,7 @@ index f2eaf6b13..341b0e448 100644 if (args.size() != 1) { PRINT_USAGE(USAGE_GET_TX_NOTE); -@@ -10069,6 +10255,8 @@ bool simple_wallet::get_tx_note(const std::vector &args) +@@ -9952,6 +10136,8 @@ bool simple_wallet::get_tx_note(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::set_description(const std::vector &args) { @@ -677,7 +661,7 @@ index f2eaf6b13..341b0e448 100644 // 0 arguments allowed, for setting the description to empty string std::string description = ""; -@@ -10085,6 +10273,8 @@ bool simple_wallet::set_description(const std::vector &args) +@@ -9968,6 +10154,8 @@ bool simple_wallet::set_description(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_description(const std::vector &args) { @@ -686,7 +670,7 @@ index f2eaf6b13..341b0e448 100644 if (args.size() != 0) { PRINT_USAGE(USAGE_GET_DESCRIPTION); -@@ -10143,6 +10333,8 @@ bool simple_wallet::wallet_info(const std::vector &args) +@@ -10026,6 +10214,8 @@ bool simple_wallet::wallet_info(const std::vector &args) type = tr("Watch only"); else if (m_wallet->multisig(&ready, &threshold, &total)) type = (boost::format(tr("%u/%u multisig%s")) % threshold % total % (ready ? "" : " (not yet finalized)")).str(); @@ -695,7 +679,7 @@ index f2eaf6b13..341b0e448 100644 else type = tr("Normal"); message_writer() << tr("Type: ") << type; -@@ -10154,6 +10346,7 @@ bool simple_wallet::wallet_info(const std::vector &args) +@@ -10037,6 +10227,7 @@ bool simple_wallet::wallet_info(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::sign(const std::vector &args) { @@ -703,7 +687,7 @@ index f2eaf6b13..341b0e448 100644 if (m_wallet->key_on_device()) { fail_msg_writer() << tr("command not supported by HW wallet"); -@@ -10261,6 +10454,7 @@ bool simple_wallet::export_key_images(const std::vector &args_) +@@ -10144,6 +10335,7 @@ bool simple_wallet::export_key_images(const std::vector &args_) fail_msg_writer() << tr("command not supported by HW wallet"); return true; } @@ -711,7 +695,7 @@ index f2eaf6b13..341b0e448 100644 auto args = args_; if (m_wallet->watch_only()) -@@ -10314,6 +10508,7 @@ bool simple_wallet::import_key_images(const std::vector &args) +@@ -10197,6 +10389,7 @@ bool simple_wallet::import_key_images(const std::vector &args) fail_msg_writer() << tr("command not supported by HW wallet"); return true; } @@ -719,7 +703,7 @@ index f2eaf6b13..341b0e448 100644 if (!m_wallet->is_trusted_daemon()) { fail_msg_writer() << tr("this command requires a trusted daemon. Enable with --trusted-daemon"); -@@ -10422,6 +10617,7 @@ bool simple_wallet::export_outputs(const std::vector &args_) +@@ -10305,6 +10498,7 @@ bool simple_wallet::export_outputs(const std::vector &args_) fail_msg_writer() << tr("command not supported by HW wallet"); return true; } @@ -727,7 +711,7 @@ index f2eaf6b13..341b0e448 100644 auto args = args_; bool all = false; -@@ -10471,6 +10667,7 @@ bool simple_wallet::import_outputs(const std::vector &args) +@@ -10354,6 +10548,7 @@ bool simple_wallet::import_outputs(const std::vector &args) fail_msg_writer() << tr("command not supported by HW wallet"); return true; } @@ -736,7 +720,7 @@ index f2eaf6b13..341b0e448 100644 { PRINT_USAGE(USAGE_IMPORT_OUTPUTS); diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h -index 7c45d45e8..79c739cdd 100644 +index 652708f5a..159da2c45 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -147,6 +147,7 @@ namespace cryptonote @@ -748,7 +732,7 @@ index 7c45d45e8..79c739cdd 100644 bool set_inactivity_lock_timeout(const std::vector &args = std::vector()); bool set_setup_background_mining(const std::vector &args = std::vector()); diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 472f05016..1a9c6f674 100644 +index d96ea97ea..7d430b655 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -54,6 +54,40 @@ using namespace cryptonote; @@ -1310,7 +1294,7 @@ index 9ea753083..4268b656e 100644 virtual AddressBook * addressBook() = 0; virtual Subaddress * subaddress() = 0; diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index e4e02c782..c7cbdbbe6 100644 +index 9e95f44d6..f2381740a 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -158,6 +158,8 @@ static const std::string MULTISIG_SIGNATURE_MAGIC = "SigMultisigPkV1"; @@ -1537,7 +1521,7 @@ index e4e02c782..c7cbdbbe6 100644 bool updated = false; if (m_pool_info_query_time != 0 && try_incremental) { -@@ -4182,6 +4263,8 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo +@@ -4183,6 +4264,8 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo } m_first_refresh_done = true; @@ -1546,7 +1530,7 @@ index e4e02c782..c7cbdbbe6 100644 LOG_PRINT_L1("Refresh done, blocks received: " << blocks_fetched << ", balance (all accounts): " << print_money(balance_all(false)) << ", unlocked: " << print_money(unlocked_balance_all(false))); } -@@ -4267,6 +4350,14 @@ wallet2::detached_blockchain_data wallet2::detach_blockchain(uint64_t height, st +@@ -4268,6 +4351,14 @@ wallet2::detached_blockchain_data wallet2::detach_blockchain(uint64_t height, st td.m_uses.pop_back(); } @@ -1561,7 +1545,7 @@ index e4e02c782..c7cbdbbe6 100644 if (output_tracker_cache) output_tracker_cache->clear(); -@@ -4341,8 +4432,12 @@ void wallet2::handle_reorg(uint64_t height, std::map m_blockchain.offset(), error::wallet_internal_error, "Daemon claims reorg below last checkpoint"); @@ -1574,7 +1558,7 @@ index e4e02c782..c7cbdbbe6 100644 if (m_callback) m_callback->on_reorg(height, dbd.detached_blockchain.size(), dbd.detached_tx_hashes.size()); } -@@ -4352,6 +4447,7 @@ bool wallet2::deinit() +@@ -4353,6 +4448,7 @@ bool wallet2::deinit() if(m_is_initialized) { m_is_initialized = false; unlock_keys_file(); @@ -1582,7 +1566,7 @@ index e4e02c782..c7cbdbbe6 100644 m_account.deinit(); } return true; -@@ -4378,6 +4474,7 @@ bool wallet2::clear() +@@ -4379,6 +4475,7 @@ bool wallet2::clear() m_device_last_key_image_sync = 0; m_pool_info_query_time = 0; m_skip_to_height = 0; @@ -1590,7 +1574,7 @@ index e4e02c782..c7cbdbbe6 100644 return true; } //---------------------------------------------------------------------------------------------------- -@@ -4396,13 +4493,30 @@ void wallet2::clear_soft(bool keep_key_images) +@@ -4397,13 +4494,30 @@ void wallet2::clear_soft(bool keep_key_images) m_scanned_pool_txs[1].clear(); m_pool_info_query_time = 0; m_skip_to_height = 0; @@ -1622,7 +1606,7 @@ index e4e02c782..c7cbdbbe6 100644 /*! * \brief Stores wallet information to wallet file. * \param keys_file_name Name of wallet file -@@ -4414,16 +4528,35 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable +@@ -4415,16 +4529,35 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable { boost::optional keys_file_data = get_keys_file_data(password, watch_only); CHECK_AND_ASSERT_MES(keys_file_data != boost::none, false, "failed to generate wallet keys data"); @@ -1662,7 +1646,7 @@ index e4e02c782..c7cbdbbe6 100644 if (e) { boost::filesystem::remove(tmp_file_name); -@@ -4435,26 +4568,27 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable +@@ -4436,26 +4569,27 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable } //---------------------------------------------------------------------------------------------------- boost::optional wallet2::get_keys_file_data(const epee::wipeable_string& password, bool watch_only) @@ -1698,7 +1682,7 @@ index e4e02c782..c7cbdbbe6 100644 account.forget_spend_key(); account.encrypt_keys(key); -@@ -4589,6 +4723,9 @@ boost::optional wallet2::get_keys_file_data(const epee: +@@ -4590,6 +4724,9 @@ boost::optional wallet2::get_keys_file_data(const epee: value2.SetInt(m_track_uses ? 1 : 0); json.AddMember("track_uses", value2, json.GetAllocator()); @@ -1708,7 +1692,7 @@ index e4e02c782..c7cbdbbe6 100644 value2.SetInt(m_show_wallet_name_when_locked ? 1 : 0); json.AddMember("show_wallet_name_when_locked", value2, json.GetAllocator()); -@@ -4648,6 +4785,11 @@ boost::optional wallet2::get_keys_file_data(const epee: +@@ -4649,6 +4786,11 @@ boost::optional wallet2::get_keys_file_data(const epee: value2.SetInt(m_polyseed ? 1 : 0); json.AddMember("polyseed", value2, json.GetAllocator()); @@ -1720,7 +1704,7 @@ index e4e02c782..c7cbdbbe6 100644 // Serialize the JSON object rapidjson::StringBuffer buffer; -@@ -4675,13 +4817,81 @@ void wallet2::setup_keys(const epee::wipeable_string &password) +@@ -4676,13 +4818,81 @@ void wallet2::setup_keys(const epee::wipeable_string &password) m_account.decrypt_viewkey(key); } @@ -1803,7 +1787,7 @@ index e4e02c782..c7cbdbbe6 100644 if (m_ask_password == AskPasswordToDecrypt && !m_unattended && !m_watch_only) decrypt_keys(original_password); setup_keys(new_password); -@@ -4740,8 +4950,24 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -4741,8 +4951,24 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st std::string account_data; account_data.resize(keys_file_data.account_data.size()); crypto::chacha20(keys_file_data.account_data.data(), keys_file_data.account_data.size(), key, keys_file_data.iv, &account_data[0]); @@ -1829,7 +1813,7 @@ index e4e02c782..c7cbdbbe6 100644 // The contents should be JSON if the wallet follows the new format. if (json.Parse(account_data.c_str()).HasParseError()) { -@@ -4779,6 +5005,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -4780,6 +5006,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st m_ignore_outputs_above = MONEY_SUPPLY; m_ignore_outputs_below = 0; m_track_uses = false; @@ -1837,7 +1821,7 @@ index e4e02c782..c7cbdbbe6 100644 m_show_wallet_name_when_locked = false; m_inactivity_lock_timeout = DEFAULT_INACTIVITY_LOCK_TIMEOUT; m_setup_background_mining = BackgroundMiningMaybe; -@@ -4797,6 +5024,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -4798,6 +5025,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st m_enable_multisig = false; m_allow_mismatched_daemon_version = false; m_polyseed = false; @@ -1845,7 +1829,7 @@ index e4e02c782..c7cbdbbe6 100644 } else if(json.IsObject()) { -@@ -5035,6 +5263,39 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -5036,6 +5264,39 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st m_enable_multisig = field_enable_multisig; GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, polyseed, int, Int, false, false); m_polyseed = field_polyseed; @@ -1885,7 +1869,7 @@ index e4e02c782..c7cbdbbe6 100644 } else { -@@ -5098,12 +5359,17 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -5099,12 +5360,17 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st const cryptonote::account_keys& keys = m_account.get_keys(); hw::device &hwdev = m_account.get_device(); r = r && hwdev.verify_keys(keys.m_view_secret_key, keys.m_account_address.m_view_public_key); @@ -1905,7 +1889,7 @@ index e4e02c782..c7cbdbbe6 100644 return true; } -@@ -5118,11 +5384,12 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -5119,11 +5385,12 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st * can be used prior to rewriting wallet keys file, to ensure user has entered the correct password * */ @@ -1920,7 +1904,7 @@ index e4e02c782..c7cbdbbe6 100644 lock_keys_file(); return r; } -@@ -5140,7 +5407,7 @@ bool wallet2::verify_password(const epee::wipeable_string& password) +@@ -5141,7 +5408,7 @@ bool wallet2::verify_password(const epee::wipeable_string& password) * can be used prior to rewriting wallet keys file, to ensure user has entered the correct password * */ @@ -1929,7 +1913,7 @@ index e4e02c782..c7cbdbbe6 100644 { rapidjson::Document json; wallet2::keys_file_data keys_file_data; -@@ -5157,9 +5424,22 @@ bool wallet2::verify_password(const std::string& keys_file_name, const epee::wip +@@ -5158,9 +5425,22 @@ bool wallet2::verify_password(const std::string& keys_file_name, const epee::wip std::string account_data; account_data.resize(keys_file_data.account_data.size()); crypto::chacha20(keys_file_data.account_data.data(), keys_file_data.account_data.size(), key, keys_file_data.iv, &account_data[0]); @@ -1953,7 +1937,7 @@ index e4e02c782..c7cbdbbe6 100644 // The contents should be JSON if the wallet follows the new format. if (json.Parse(account_data.c_str()).HasParseError()) { -@@ -5184,6 +5464,7 @@ bool wallet2::verify_password(const std::string& keys_file_name, const epee::wip +@@ -5185,6 +5465,7 @@ bool wallet2::verify_password(const std::string& keys_file_name, const epee::wip r = r && hwdev.verify_keys(keys.m_view_secret_key, keys.m_account_address.m_view_public_key); if(!no_spend_key) r = r && hwdev.verify_keys(keys.m_spend_secret_key, keys.m_account_address.m_spend_public_key); @@ -1961,7 +1945,7 @@ index e4e02c782..c7cbdbbe6 100644 return r; } -@@ -5195,9 +5476,7 @@ void wallet2::encrypt_keys(const crypto::chacha_key &key) +@@ -5196,9 +5477,7 @@ void wallet2::encrypt_keys(const crypto::chacha_key &key) void wallet2::decrypt_keys(const crypto::chacha_key &key) { @@ -1972,7 +1956,7 @@ index e4e02c782..c7cbdbbe6 100644 m_account.encrypt_viewkey(key); m_account.decrypt_keys(key); -@@ -5915,11 +6194,30 @@ void wallet2::rewrite(const std::string& wallet_name, const epee::wipeable_strin +@@ -5916,11 +6195,30 @@ void wallet2::rewrite(const std::string& wallet_name, const epee::wipeable_strin { if (wallet_name.empty()) return; @@ -2003,7 +1987,7 @@ index e4e02c782..c7cbdbbe6 100644 } /*! * \brief Writes to a file named based on the normal wallet (doesn't generate key, assumes it's already there) -@@ -5953,6 +6251,16 @@ bool wallet2::wallet_valid_path_format(const std::string& file_path) +@@ -5954,6 +6252,16 @@ bool wallet2::wallet_valid_path_format(const std::string& file_path) return !file_path.empty(); } //---------------------------------------------------------------------------------------------------- @@ -2020,7 +2004,7 @@ index e4e02c782..c7cbdbbe6 100644 bool wallet2::parse_long_payment_id(const std::string& payment_id_str, crypto::hash& payment_id) { cryptonote::blobdata payment_id_data; -@@ -6188,10 +6496,81 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass +@@ -6189,10 +6497,81 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass THROW_WALLET_EXCEPTION_IF(true, error::file_read_error, "failed to load keys from buffer"); } @@ -2103,7 +2087,7 @@ index e4e02c782..c7cbdbbe6 100644 bool cache_missing = use_fs ? (!boost::filesystem::exists(m_wallet_file, e) || e) : cache_buf.empty(); if (cache_missing) { -@@ -6205,7 +6584,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass +@@ -6206,7 +6585,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass bool r = true; if (use_fs) { @@ -2112,7 +2096,7 @@ index e4e02c782..c7cbdbbe6 100644 THROW_WALLET_EXCEPTION_IF(!r, error::file_read_error, m_wallet_file); } -@@ -6218,7 +6597,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass +@@ -6219,7 +6598,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass THROW_WALLET_EXCEPTION_IF(!r, error::wallet_internal_error, "internal error: failed to deserialize \"" + m_wallet_file + '\"'); std::string cache_data; cache_data.resize(cache_file_data.cache_data.size()); @@ -2121,7 +2105,7 @@ index e4e02c782..c7cbdbbe6 100644 try { bool loaded = false; -@@ -6308,60 +6687,76 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass +@@ -6309,60 +6688,76 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass m_account_public_address.m_view_public_key != m_account.get_keys().m_account_address.m_view_public_key, error::wallet_files_doesnt_correspond, m_keys_file, m_wallet_file); } @@ -2240,7 +2224,7 @@ index e4e02c782..c7cbdbbe6 100644 } } //---------------------------------------------------------------------------------------------------- -@@ -6443,6 +6838,8 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas +@@ -6444,6 +6839,8 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas same_file = canonical_old_path == canonical_new_path; } @@ -2249,7 +2233,7 @@ index e4e02c782..c7cbdbbe6 100644 if (!same_file) { -@@ -6459,6 +6856,21 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas +@@ -6460,6 +6857,21 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas } } } @@ -2271,7 +2255,7 @@ index e4e02c782..c7cbdbbe6 100644 // get wallet cache data boost::optional cache_file_data = get_cache_file_data(); -@@ -6552,6 +6964,22 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas +@@ -6553,6 +6965,22 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas // store should only exist if the MMS is really active m_message_store.write_to_file(get_multisig_wallet_state(), m_mms_file); } @@ -2294,7 +2278,7 @@ index e4e02c782..c7cbdbbe6 100644 } //---------------------------------------------------------------------------------------------------- boost::optional wallet2::get_cache_file_data() -@@ -6569,7 +6997,7 @@ boost::optional wallet2::get_cache_file_data() +@@ -6570,7 +6998,7 @@ boost::optional wallet2::get_cache_file_data() std::string cipher; cipher.resize(cache_file_data.get().cache_data.size()); cache_file_data.get().iv = crypto::rand(); @@ -2303,7 +2287,7 @@ index e4e02c782..c7cbdbbe6 100644 cache_file_data.get().cache_data = cipher; return cache_file_data; } -@@ -8645,6 +9073,34 @@ bool wallet2::is_keys_file_locked() const +@@ -8646,6 +9074,34 @@ bool wallet2::is_keys_file_locked() const return m_keys_file_locker->locked(); } @@ -2338,7 +2322,7 @@ index e4e02c782..c7cbdbbe6 100644 bool wallet2::tx_add_fake_output(std::vector> &outs, uint64_t global_index, const crypto::public_key& output_public_key, const rct::key& mask, uint64_t real_index, bool unlocked, std::unordered_set &valid_public_keys_cache) const { if (!unlocked) // don't add locked outs -@@ -13980,6 +14436,413 @@ bool wallet2::import_key_images(signed_tx_set & signed_tx, size_t offset, bool o +@@ -13978,6 +14434,413 @@ bool wallet2::import_key_images(signed_tx_set & signed_tx, size_t offset, bool o return import_key_images(signed_tx.key_images, offset, only_selected_transfers ? boost::make_optional(selected_transfers) : boost::none); } @@ -2753,7 +2737,7 @@ index e4e02c782..c7cbdbbe6 100644 { payment_container payments; diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index b540eff6b..d37332dd1 100644 +index 91ec72e0f..56cc118f4 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -257,6 +257,20 @@ private: @@ -3063,7 +3047,7 @@ index b540eff6b..d37332dd1 100644 } diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h -index 1f7e1c75d..d17b721a9 100644 +index c077313d4..c54cd3499 100644 --- a/src/wallet/wallet_errors.h +++ b/src/wallet/wallet_errors.h @@ -63,6 +63,7 @@ namespace tools @@ -3074,7 +3058,7 @@ index 1f7e1c75d..d17b721a9 100644 // refresh_error * // acc_outs_lookup_error // block_parse_error -@@ -96,6 +97,9 @@ namespace tools +@@ -97,6 +98,9 @@ namespace tools // wallet_files_doesnt_correspond // scan_tx_error * // wont_reprocess_recent_txs_via_untrusted_daemon @@ -3084,7 +3068,7 @@ index 1f7e1c75d..d17b721a9 100644 // // * - class with protected ctor -@@ -303,6 +307,16 @@ namespace tools +@@ -304,6 +308,16 @@ namespace tools std::string to_string() const { return wallet_logic_error::to_string(); } }; @@ -3101,7 +3085,7 @@ index 1f7e1c75d..d17b721a9 100644 //---------------------------------------------------------------------------------------------------- struct invalid_pregenerated_random : public wallet_logic_error { -@@ -944,6 +958,31 @@ namespace tools +@@ -947,6 +961,31 @@ namespace tools } }; //---------------------------------------------------------------------------------------------------- @@ -3134,7 +3118,7 @@ index 1f7e1c75d..d17b721a9 100644 #if !defined(_MSC_VER) diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp -index 4e42d64cd..822fc828b 100644 +index b1419949f..d24b4c563 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -73,6 +73,54 @@ using namespace epee; @@ -3299,7 +3283,7 @@ index 4e42d64cd..822fc828b 100644 crypto::hash8 integrated_payment_id = crypto::null_hash8; std::string extra_nonce; for (auto it = destinations.begin(); it != destinations.end(); it++) -@@ -1192,6 +1256,7 @@ namespace tools +@@ -1204,6 +1268,7 @@ namespace tools } CHECK_MULTISIG_ENABLED(); @@ -3307,7 +3291,7 @@ index 4e42d64cd..822fc828b 100644 cryptonote::blobdata blob; if (!epee::string_tools::parse_hexstr_to_binbuff(req.unsigned_txset, blob)) -@@ -1273,6 +1338,7 @@ namespace tools +@@ -1285,6 +1350,7 @@ namespace tools er.message = "command not supported by watch-only wallet"; return false; } @@ -3315,7 +3299,7 @@ index 4e42d64cd..822fc828b 100644 if(req.unsigned_txset.empty() && req.multisig_txset.empty()) { er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR; -@@ -1542,6 +1608,7 @@ namespace tools +@@ -1554,6 +1620,7 @@ namespace tools } CHECK_MULTISIG_ENABLED(); @@ -3323,7 +3307,7 @@ index 4e42d64cd..822fc828b 100644 try { -@@ -2091,6 +2158,7 @@ namespace tools +@@ -2115,6 +2182,7 @@ namespace tools er.message = "The wallet is watch-only. Cannot retrieve seed."; return false; } @@ -3331,7 +3315,7 @@ index 4e42d64cd..822fc828b 100644 if (!m_wallet->is_deterministic()) { er.code = WALLET_RPC_ERROR_CODE_NON_DETERMINISTIC; -@@ -2119,6 +2187,7 @@ namespace tools +@@ -2143,6 +2211,7 @@ namespace tools er.message = "The wallet is watch-only. Cannot retrieve spend key."; return false; } @@ -3339,7 +3323,7 @@ index 4e42d64cd..822fc828b 100644 epee::wipeable_string key = epee::to_hex::wipeable_string(m_wallet->get_account().get_keys().m_spend_secret_key); res.key = std::string(key.data(), key.size()); } -@@ -2140,6 +2209,7 @@ namespace tools +@@ -2164,6 +2233,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3347,7 +3331,7 @@ index 4e42d64cd..822fc828b 100644 try { -@@ -2153,6 +2223,79 @@ namespace tools +@@ -2177,6 +2247,79 @@ namespace tools return true; } //------------------------------------------------------------------------------------------------------------------------------ @@ -3427,7 +3411,7 @@ index 4e42d64cd..822fc828b 100644 bool wallet_rpc_server::on_sign(const wallet_rpc::COMMAND_RPC_SIGN::request& req, wallet_rpc::COMMAND_RPC_SIGN::response& res, epee::json_rpc::error& er, const connection_context *ctx) { if (!m_wallet) return not_open(er); -@@ -2162,6 +2305,7 @@ namespace tools +@@ -2186,6 +2329,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3435,7 +3419,7 @@ index 4e42d64cd..822fc828b 100644 tools::wallet2::message_signature_type_t signature_type = tools::wallet2::sign_with_spend_key; if (req.signature_type == "spend" || req.signature_type == "") -@@ -2254,6 +2398,7 @@ namespace tools +@@ -2278,6 +2422,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3443,7 +3427,7 @@ index 4e42d64cd..822fc828b 100644 if (req.txids.size() != req.notes.size()) { -@@ -2326,6 +2471,7 @@ namespace tools +@@ -2350,6 +2495,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3451,7 +3435,7 @@ index 4e42d64cd..822fc828b 100644 m_wallet->set_attribute(req.key, req.value); -@@ -2353,6 +2499,7 @@ namespace tools +@@ -2377,6 +2523,7 @@ namespace tools bool wallet_rpc_server::on_get_tx_key(const wallet_rpc::COMMAND_RPC_GET_TX_KEY::request& req, wallet_rpc::COMMAND_RPC_GET_TX_KEY::response& res, epee::json_rpc::error& er, const connection_context *ctx) { if (!m_wallet) return not_open(er); @@ -3459,7 +3443,7 @@ index 4e42d64cd..822fc828b 100644 crypto::hash txid; if (!epee::string_tools::hex_to_pod(req.txid, txid)) -@@ -2444,6 +2591,7 @@ namespace tools +@@ -2468,6 +2615,7 @@ namespace tools bool wallet_rpc_server::on_get_tx_proof(const wallet_rpc::COMMAND_RPC_GET_TX_PROOF::request& req, wallet_rpc::COMMAND_RPC_GET_TX_PROOF::response& res, epee::json_rpc::error& er, const connection_context *ctx) { if (!m_wallet) return not_open(er); @@ -3467,7 +3451,7 @@ index 4e42d64cd..822fc828b 100644 crypto::hash txid; if (!epee::string_tools::hex_to_pod(req.txid, txid)) -@@ -2560,6 +2708,7 @@ namespace tools +@@ -2584,6 +2732,7 @@ namespace tools bool wallet_rpc_server::on_get_reserve_proof(const wallet_rpc::COMMAND_RPC_GET_RESERVE_PROOF::request& req, wallet_rpc::COMMAND_RPC_GET_RESERVE_PROOF::response& res, epee::json_rpc::error& er, const connection_context *ctx) { if (!m_wallet) return not_open(er); @@ -3475,7 +3459,7 @@ index 4e42d64cd..822fc828b 100644 boost::optional> account_minreserve; if (!req.all) -@@ -2802,6 +2951,7 @@ namespace tools +@@ -2826,6 +2975,7 @@ namespace tools er.message = "command not supported by HW wallet"; return false; } @@ -3483,7 +3467,7 @@ index 4e42d64cd..822fc828b 100644 try { -@@ -2831,6 +2981,7 @@ namespace tools +@@ -2855,6 +3005,7 @@ namespace tools er.message = "command not supported by HW wallet"; return false; } @@ -3491,7 +3475,7 @@ index 4e42d64cd..822fc828b 100644 cryptonote::blobdata blob; if (!epee::string_tools::parse_hexstr_to_binbuff(req.outputs_data_hex, blob)) -@@ -2856,6 +3007,7 @@ namespace tools +@@ -2880,6 +3031,7 @@ namespace tools bool wallet_rpc_server::on_export_key_images(const wallet_rpc::COMMAND_RPC_EXPORT_KEY_IMAGES::request& req, wallet_rpc::COMMAND_RPC_EXPORT_KEY_IMAGES::response& res, epee::json_rpc::error& er, const connection_context *ctx) { if (!m_wallet) return not_open(er); @@ -3499,7 +3483,7 @@ index 4e42d64cd..822fc828b 100644 try { std::pair>> ski = m_wallet->export_key_images(req.all); -@@ -2892,6 +3044,7 @@ namespace tools +@@ -2916,6 +3068,7 @@ namespace tools er.message = "This command requires a trusted daemon."; return false; } @@ -3507,7 +3491,7 @@ index 4e42d64cd..822fc828b 100644 try { std::vector> ski; -@@ -2960,6 +3113,7 @@ namespace tools +@@ -2984,6 +3137,7 @@ namespace tools bool wallet_rpc_server::on_get_address_book(const wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY::request& req, wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY::response& res, epee::json_rpc::error& er, const connection_context *ctx) { if (!m_wallet) return not_open(er); @@ -3515,7 +3499,7 @@ index 4e42d64cd..822fc828b 100644 const auto ab = m_wallet->get_address_book(); if (req.entries.empty()) { -@@ -3005,6 +3159,7 @@ namespace tools +@@ -3029,6 +3183,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3523,7 +3507,7 @@ index 4e42d64cd..822fc828b 100644 cryptonote::address_parse_info info; er.message = ""; -@@ -3047,6 +3202,7 @@ namespace tools +@@ -3071,6 +3226,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3531,7 +3515,7 @@ index 4e42d64cd..822fc828b 100644 const auto ab = m_wallet->get_address_book(); if (req.index >= ab.size()) -@@ -3109,6 +3265,7 @@ namespace tools +@@ -3133,6 +3289,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3539,7 +3523,7 @@ index 4e42d64cd..822fc828b 100644 const auto ab = m_wallet->get_address_book(); if (req.index >= ab.size()) -@@ -3179,6 +3336,7 @@ namespace tools +@@ -3203,6 +3360,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3547,7 +3531,7 @@ index 4e42d64cd..822fc828b 100644 std::unordered_set txids; std::list::const_iterator i = req.txids.begin(); -@@ -3218,6 +3376,7 @@ namespace tools +@@ -3242,6 +3400,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3555,7 +3539,7 @@ index 4e42d64cd..822fc828b 100644 try { m_wallet->rescan_spent(); -@@ -3482,6 +3641,7 @@ namespace tools +@@ -3506,6 +3665,7 @@ namespace tools er.message = "Command unavailable in restricted mode."; return false; } @@ -3563,7 +3547,7 @@ index 4e42d64cd..822fc828b 100644 if (m_wallet->verify_password(req.old_password)) { try -@@ -4009,6 +4169,7 @@ namespace tools +@@ -4033,6 +4193,7 @@ namespace tools er.message = "wallet is watch-only and cannot be made multisig"; return false; } @@ -3571,7 +3555,7 @@ index 4e42d64cd..822fc828b 100644 res.multisig_info = m_wallet->get_multisig_first_kex_msg(); return true; -@@ -4036,6 +4197,7 @@ namespace tools +@@ -4060,6 +4221,7 @@ namespace tools er.message = "wallet is watch-only and cannot be made multisig"; return false; } @@ -3678,15 +3662,16 @@ index b6098d95c..a44b56ed6 100644 } } diff --git a/src/wallet/wallet_rpc_server_error_codes.h b/src/wallet/wallet_rpc_server_error_codes.h -index 734229380..b964036bd 100644 +index 541d29f86..6e88f6967 100644 --- a/src/wallet/wallet_rpc_server_error_codes.h +++ b/src/wallet/wallet_rpc_server_error_codes.h -@@ -79,3 +79,5 @@ - #define WALLET_RPC_ERROR_CODE_ZERO_AMOUNT -46 - #define WALLET_RPC_ERROR_CODE_INVALID_SIGNATURE_TYPE -47 +@@ -81,3 +81,5 @@ #define WALLET_RPC_ERROR_CODE_DISABLED -48 -+#define WALLET_RPC_ERROR_CODE_IS_BACKGROUND_WALLET -49 -+#define WALLET_RPC_ERROR_CODE_IS_BACKGROUND_SYNCING -50 + #define WALLET_RPC_ERROR_CODE_PROXY_ALREADY_DEFINED -49 + #define WALLET_RPC_ERROR_CODE_NONZERO_UNLOCK_TIME -50 ++#define WALLET_RPC_ERROR_CODE_IS_BACKGROUND_WALLET -51 ++#define WALLET_RPC_ERROR_CODE_IS_BACKGROUND_SYNCING -52 +\ No newline at end of file diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py index 4063911f4..60eb09a10 100755 --- a/tests/functional_tests/transfer.py @@ -4327,5 +4312,5 @@ index 1e10e1f86..bff33a561 100644 + } + return self.rpc.send_json_rpc_request(stop_background_sync) -- -2.44.0 +2.39.2 diff --git a/patches/monero/0003-airgap.patch b/patches/monero/0003-airgap.patch index e3aeae9..eebe097 100644 --- a/patches/monero/0003-airgap.patch +++ b/patches/monero/0003-airgap.patch @@ -1,7 +1,7 @@ -From 5c1727c760557c0fd83ba1e4e66be2d10c58e890 Mon Sep 17 00:00:00 2001 +From 5385d085c547b675adfccb64314d1c6f7bf2d508 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 12 Mar 2024 10:09:50 +0100 -Subject: [PATCH] airgap +Subject: [PATCH 03/16] airgap --- src/wallet/api/wallet.cpp | 23 ++++++++++++++++++ @@ -12,7 +12,7 @@ Subject: [PATCH] airgap 5 files changed, 68 insertions(+), 6 deletions(-) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 1a9c6f674..42887dced 100644 +index 7d430b655..837b98e6b 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -1129,6 +1129,24 @@ uint64_t WalletImpl::unlockedBalance(uint32_t accountIndex) const @@ -94,7 +94,7 @@ index 4268b656e..4edaefefd 100644 * \brief exportKeyImages - exports key images to file * \param filename diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index c7cbdbbe6..794992b2e 100644 +index f2381740a..41cf1fd41 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -949,6 +949,16 @@ uint32_t get_subaddress_clamped_sum(uint32_t idx, uint32_t extra) @@ -114,7 +114,7 @@ index c7cbdbbe6..794992b2e 100644 static void setup_shim(hw::wallet_shim * shim, tools::wallet2 * wallet) { shim->get_tx_pub_key_from_received_outs = std::bind(&tools::wallet2::get_tx_pub_key_from_received_outs, wallet, std::placeholders::_1); -@@ -7037,6 +7047,25 @@ uint64_t wallet2::unlocked_balance(uint32_t index_major, bool strict, uint64_t * +@@ -7038,6 +7048,25 @@ uint64_t wallet2::unlocked_balance(uint32_t index_major, bool strict, uint64_t * return amount; } //---------------------------------------------------------------------------------------------------- @@ -140,7 +140,7 @@ index c7cbdbbe6..794992b2e 100644 std::map wallet2::balance_per_subaddress(uint32_t index_major, bool strict) const { std::map amount_per_subaddr; -@@ -7887,9 +7916,7 @@ bool wallet2::sign_tx(unsigned_tx_set &exported_txs, std::vector additional_derivations; @@ -179,7 +179,7 @@ index c7cbdbbe6..794992b2e 100644 if (unused_dust_indices_per_subaddr.empty()) unused_dust_indices_per_subaddr.push_back({}); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index d37332dd1..fc69b3d36 100644 +index 56cc118f4..b9aa7a00d 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -1172,6 +1172,7 @@ private: @@ -191,5 +191,5 @@ index d37332dd1..fc69b3d36 100644 std::map balance_per_subaddress(uint32_t subaddr_index_major, bool strict) const; std::map>> unlocked_balance_per_subaddress(uint32_t subaddr_index_major, bool strict); -- -2.43.0 +2.39.2 diff --git a/patches/monero/0004-coin-control.patch b/patches/monero/0004-coin-control.patch index fd777c3..1700a61 100644 --- a/patches/monero/0004-coin-control.patch +++ b/patches/monero/0004-coin-control.patch @@ -1,7 +1,7 @@ -From 8e069a8b7c15794b843471487c12c2c753d3afe2 Mon Sep 17 00:00:00 2001 +From d6d52b6156f1e83a69474a871043d414e4488f62 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 12 Mar 2024 11:07:57 +0100 -Subject: [PATCH 04/10] coin control +Subject: [PATCH 04/16] coin control --- src/wallet/api/CMakeLists.txt | 8 +- @@ -9,12 +9,12 @@ Subject: [PATCH 04/10] coin control src/wallet/api/coins.h | 40 ++++++++ src/wallet/api/coins_info.cpp | 122 ++++++++++++++++++++++ src/wallet/api/coins_info.h | 71 +++++++++++++ - src/wallet/api/wallet.cpp | 31 +++++- + src/wallet/api/wallet.cpp | 26 ++++- src/wallet/api/wallet.h | 10 +- src/wallet/api/wallet2_api.h | 52 +++++++++- src/wallet/wallet2.cpp | 46 ++++++++- src/wallet/wallet2.h | 11 +- - 10 files changed, 558 insertions(+), 18 deletions(-) + 10 files changed, 555 insertions(+), 16 deletions(-) create mode 100644 src/wallet/api/coins.cpp create mode 100644 src/wallet/api/coins.h create mode 100644 src/wallet/api/coins_info.cpp @@ -489,7 +489,7 @@ index 000000000..c43e45abd + +#endif //FEATHER_COINS_INFO_H diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 42887dced..2fe0d1d29 100644 +index 837b98e6b..2106dbd07 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -35,6 +35,7 @@ @@ -537,24 +537,7 @@ index 42887dced..2fe0d1d29 100644 if (error) { break; } -@@ -1833,13 +1848,14 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectoradjust_mixin(mixin_count); - - if (amount) { -+ // (std::vector dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const unique_index_container& subtract_fee_from_outputs, const std::vector& preferred_input_list) - transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */, - adjusted_priority, -- extra, subaddr_account, subaddr_indices); -+ extra, subaddr_account, subaddr_indices, preferred_input_list); - } else { - transaction->m_pending_tx = m_wallet->create_transactions_all(0, info.address, info.is_subaddress, 1, fake_outs_count, 0 /* unlock_time */, - adjusted_priority, -- extra, subaddr_account, subaddr_indices); -+ extra, subaddr_account, subaddr_indices, preferred_input_list); - } - pendingTxPostProcess(transaction); - -@@ -1920,10 +1936,10 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector amount, uint32_t mixin_count, @@ -567,7 +550,7 @@ index 42887dced..2fe0d1d29 100644 } PendingTransaction *WalletImpl::createSweepUnmixableTransaction() -@@ -2048,6 +2064,11 @@ AddressBook *WalletImpl::addressBook() +@@ -2048,6 +2063,11 @@ AddressBook *WalletImpl::addressBook() return m_addressBook.get(); } @@ -717,7 +700,7 @@ index 4edaefefd..8a5c4135e 100644 virtual SubaddressAccount * subaddressAccount() = 0; virtual void setListener(WalletListener *) = 0; diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index 700816da6..5331f90fc 100644 +index 41cf1fd41..61601f70c 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2083,12 +2083,21 @@ bool wallet2::frozen(const multisig_tx_set& txs) const @@ -820,8 +803,8 @@ index 700816da6..5331f90fc 100644 // This system allows for sending (almost) the entire balance, since it does // not generate spurious change in all txes, thus decreasing the instantaneous // usable balance. --std::vector wallet2::create_transactions_2(std::vector dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const unique_index_container& subtract_fee_from_outputs) -+std::vector wallet2::create_transactions_2(std::vector dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list, const unique_index_container& subtract_fee_from_outputs) +-std::vector wallet2::create_transactions_2(std::vector dsts, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const unique_index_container& subtract_fee_from_outputs) ++std::vector wallet2::create_transactions_2(std::vector dsts, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list, const unique_index_container& subtract_fee_from_outputs) { //ensure device is let in NONE mode in any case hw::device &hwdev = m_account.get_device(); @@ -835,7 +818,7 @@ index 700816da6..5331f90fc 100644 if (m_ignore_fractional_outputs && td.amount() < fractional_threshold) { MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below fractional threshold " << print_money(fractional_threshold)); -@@ -11393,7 +11428,7 @@ std::vector wallet2::create_transactions_2(std::vector wallet2::create_transactions_2(std::vector &ptx_vector, c +@@ -11879,7 +11914,7 @@ bool wallet2::sanity_check(const std::vector &ptx_vector, c return true; } --std::vector wallet2::create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices) -+std::vector wallet2::create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list) +-std::vector wallet2::create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices) ++std::vector wallet2::create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list) { std::vector unused_transfers_indices; std::vector unused_dust_indices; -@@ -11903,6 +11938,9 @@ std::vector wallet2::create_transactions_all(uint64_t below +@@ -11908,6 +11943,9 @@ std::vector wallet2::create_transactions_all(uint64_t below for (size_t i = 0; i < m_transfers.size(); ++i) { const transfer_details& td = m_transfers[i]; @@ -864,19 +847,19 @@ index 700816da6..5331f90fc 100644 { MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below threshold " << print_money(fractional_threshold)); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index fc69b3d36..52886fb85 100644 +index b9aa7a00d..67ed81383 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -1207,8 +1207,8 @@ private: bool parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const; bool load_tx(const std::string &signed_filename, std::vector &ptx, std::function accept_func = NULL); bool parse_tx_from_str(const std::string &signed_tx_st, std::vector &ptx, std::function accept_func); -- std::vector create_transactions_2(std::vector dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const unique_index_container& subtract_fee_from_outputs = {}); // pass subaddr_indices by value on purpose -- std::vector create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices); -+ std::vector create_transactions_2(std::vector dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list = {}, const unique_index_container& subtract_fee_from_outputs = {}); // pass subaddr_indices by value on purpose -+ std::vector create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list = {}); - std::vector create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra); - std::vector create_transactions_from(const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, std::vector unused_transfers_indices, std::vector unused_dust_indices, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector& extra); +- std::vector create_transactions_2(std::vector dsts, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const unique_index_container& subtract_fee_from_outputs = {}); // pass subaddr_indices by value on purpose +- std::vector create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices); ++ std::vector create_transactions_2(std::vector dsts, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list, const unique_index_container& subtract_fee_from_outputs = {}); // pass subaddr_indices by value on purpose ++ std::vector create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list = {}); + std::vector create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, uint32_t priority, const std::vector& extra); + std::vector create_transactions_from(const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, std::vector unused_transfers_indices, std::vector unused_dust_indices, const size_t fake_outs_count, uint32_t priority, const std::vector& extra); bool sanity_check(const std::vector &ptx_vector, const std::vector& dsts, const unique_index_container& subtract_fee_from_outputs = {}) const; @@ -1560,6 +1560,7 @@ private: uint64_t get_num_rct_outputs(); @@ -915,5 +898,5 @@ index fc69b3d36..52886fb85 100644 void set_unspent(size_t idx); bool is_spent(const transfer_details &td, bool strict = true) const; -- -2.44.0 +2.39.2 diff --git a/patches/monero/0005-fix-build-issues.patch b/patches/monero/0005-fix-build-issues.patch index 2215c99..985df3e 100644 --- a/patches/monero/0005-fix-build-issues.patch +++ b/patches/monero/0005-fix-build-issues.patch @@ -1,7 +1,7 @@ -From a24797410dcda06617ff2a81de3129d38b69f2a2 Mon Sep 17 00:00:00 2001 +From 0f1d5e1296dc1e8c9ee323fa7bdf706ff76df2a7 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Tue, 12 Mar 2024 17:59:13 +0100 -Subject: [PATCH 05/10] fix build issues +Subject: [PATCH 05/16] fix build issues --- contrib/depends/hosts/linux.mk | 8 +++---- @@ -133,5 +133,5 @@ index 000000000..f05cb2b6a + #else + #ifdef POLYSEED_SHARED -- -2.44.0 +2.39.2 diff --git a/patches/monero/0006-macos-build-fix.patch b/patches/monero/0006-macos-build-fix.patch index c149232..f7c48b9 100644 --- a/patches/monero/0006-macos-build-fix.patch +++ b/patches/monero/0006-macos-build-fix.patch @@ -1,13 +1,13 @@ -From bc3d91b07d77893983bbed0b165ce41e034579a7 Mon Sep 17 00:00:00 2001 +From 3343e3fbbd05546b3858c98afe3bad4673f250c8 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 28 Mar 2024 02:03:08 +0100 -Subject: [PATCH 06/10] macos build fix +Subject: [PATCH 06/16] macos build fix --- contrib/depends/hosts/darwin.mk | 2 + contrib/depends/packages/polyseed.mk | 13 +++-- - .../polyseed/0001-disable-soname.patch | 49 +++++++++++++++++++ - 3 files changed, 60 insertions(+), 4 deletions(-) + .../polyseed/0001-disable-soname.patch | 48 +++++++++++++++++++ + 3 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 contrib/depends/patches/polyseed/0001-disable-soname.patch diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk @@ -57,10 +57,10 @@ index 2ddeac621..0071b20f3 100644 define $(package)_stage_cmds diff --git a/contrib/depends/patches/polyseed/0001-disable-soname.patch b/contrib/depends/patches/polyseed/0001-disable-soname.patch new file mode 100644 -index 000000000..a261636e8 +index 000000000..bd97dd394 --- /dev/null +++ b/contrib/depends/patches/polyseed/0001-disable-soname.patch -@@ -0,0 +1,49 @@ +@@ -0,0 +1,48 @@ +From aabafcfc0572651436d024a635483c49042fad7f Mon Sep 17 00:00:00 2001 +From: Czarek Nakamoto +Date: Thu, 28 Mar 2024 00:32:51 +0100 @@ -81,7 +81,7 @@ index 000000000..a261636e8 ++ NO_SONAME 1 + C_STANDARD 11 + C_STANDARD_REQUIRED ON) -+ ++ +@@ -45,16 +46,17 @@ include_directories(polyseed_static + include/) + target_compile_definitions(polyseed_static PRIVATE POLYSEED_STATIC) @@ -89,7 +89,7 @@ index 000000000..a261636e8 ++ NO_SONAME 1 + C_STANDARD 11 + C_STANDARD_REQUIRED ON) -+ ++ +-add_executable(polyseed-tests +- tests/tests.c) +-include_directories(polyseed-tests @@ -104,12 +104,11 @@ index 000000000..a261636e8 ++# target_compile_definitions(polyseed-tests PRIVATE POLYSEED_STATIC) ++# target_link_libraries(polyseed-tests ++# PRIVATE polyseed_static) -+ ++ + include(GNUInstallDirs) + install(TARGETS polyseed polyseed_static -+-- ++-- +2.39.2 -+ -- -2.44.0 +2.39.2 diff --git a/patches/monero/0007-fix-make-debug-test-target.patch b/patches/monero/0007-fix-make-debug-test-target.patch index 25827bb..f39c49e 100644 --- a/patches/monero/0007-fix-make-debug-test-target.patch +++ b/patches/monero/0007-fix-make-debug-test-target.patch @@ -1,46 +1,39 @@ -From 14b4c210a11e0c333087026775cf22fcccf46a40 Mon Sep 17 00:00:00 2001 +From 8945e9865ef831f85ef58ba3d269f4b17d0270b5 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Tue, 2 Apr 2024 01:13:12 +0200 -Subject: [PATCH 07/10] fix `make debug-test` target +Subject: [PATCH 07/16] fix `make debug-test` target --- - src/simplewallet/simplewallet.cpp | 4 ++-- - src/wallet/wallet_rpc_server.cpp | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) + src/simplewallet/simplewallet.cpp | 2 +- + src/wallet/wallet2.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp -index 341b0e448..c2e16da4c 100644 +index f8ed6659c..0aa76b668 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp -@@ -6976,13 +6976,13 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vectorcreate_transactions_2(dsts, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, subtract_fee_from_outputs); -+ ptx_vector = m_wallet->create_transactions_2(dsts, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, {}, subtract_fee_from_outputs); - break; - default: - LOG_ERROR("Unknown transfer method, using default"); - /* FALLTHRU */ - case Transfer: -- ptx_vector = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, subtract_fee_from_outputs); -+ ptx_vector = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, {}, subtract_fee_from_outputs); - break; - } +@@ -6929,7 +6929,7 @@ bool simple_wallet::transfer_main(const std::vector &args_, bool ca + { + // figure out what tx will be necessary + auto ptx_vector = m_wallet->create_transactions_2(dsts, fake_outs_count, priority, extra, +- m_current_subaddress_account, subaddr_indices, subtract_fee_from_outputs); ++ m_current_subaddress_account, subaddr_indices, {}, subtract_fee_from_outputs); -diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp -index 822fc828b..caa23e636 100644 ---- a/src/wallet/wallet_rpc_server.cpp -+++ b/src/wallet/wallet_rpc_server.cpp -@@ -1157,7 +1157,7 @@ namespace tools + if (ptx_vector.empty()) { - uint64_t mixin = m_wallet->adjust_mixin(req.ring_size ? req.ring_size - 1 : 0); - uint32_t priority = m_wallet->adjust_priority(req.priority); -- std::vector ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, req.subtract_fee_from_outputs); -+ std::vector ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, {}, req.subtract_fee_from_outputs); - - if (ptx_vector.empty()) - { +diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h +index 67ed81383..fdc1a6212 100644 +--- a/src/wallet/wallet2.h ++++ b/src/wallet/wallet2.h +@@ -1207,7 +1207,7 @@ private: + bool parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const; + bool load_tx(const std::string &signed_filename, std::vector &ptx, std::function accept_func = NULL); + bool parse_tx_from_str(const std::string &signed_tx_st, std::vector &ptx, std::function accept_func); +- std::vector create_transactions_2(std::vector dsts, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list, const unique_index_container& subtract_fee_from_outputs = {}); // pass subaddr_indices by value on purpose ++ std::vector create_transactions_2(std::vector dsts, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list = {}, const unique_index_container& subtract_fee_from_outputs = {}); // pass subaddr_indices by value on purpose + std::vector create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, uint32_t priority, const std::vector& extra, uint32_t subaddr_account, std::set subaddr_indices, const std::vector& preferred_input_list = {}); + std::vector create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, uint32_t priority, const std::vector& extra); + std::vector create_transactions_from(const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, std::vector unused_transfers_indices, std::vector unused_dust_indices, const size_t fake_outs_count, uint32_t priority, const std::vector& extra); -- -2.44.0 +2.39.2 diff --git a/patches/monero/0008-fix-missing-___clear_cache-when-targetting-iOS.patch b/patches/monero/0008-fix-missing-___clear_cache-when-targetting-iOS.patch index cdd4ef2..5b46d7c 100644 --- a/patches/monero/0008-fix-missing-___clear_cache-when-targetting-iOS.patch +++ b/patches/monero/0008-fix-missing-___clear_cache-when-targetting-iOS.patch @@ -1,7 +1,7 @@ -From d3a704bfb62bede87d5da0261585f62f19f858c1 Mon Sep 17 00:00:00 2001 +From c7f8510fb4bfb54707053603f5cbcaa8c0bf72d2 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Tue, 2 Apr 2024 16:51:56 +0200 -Subject: [PATCH 08/10] fix missing ___clear_cache when targetting iOS +Subject: [PATCH 08/16] fix missing ___clear_cache when targetting iOS --- .gitmodules | 2 +- @@ -29,5 +29,5 @@ index 102f8acf9..ce72c9bb9 160000 -Subproject commit 102f8acf90a7649ada410de5499a7ec62e49e1da +Subproject commit ce72c9bb9cb799e0d9171094b9abb009e04c5bfc -- -2.44.0 +2.39.2 diff --git a/patches/monero/0009-Add-recoverDeterministicWalletFromSpendKey.patch b/patches/monero/0009-Add-recoverDeterministicWalletFromSpendKey.patch index 3c2510e..0ef9900 100644 --- a/patches/monero/0009-Add-recoverDeterministicWalletFromSpendKey.patch +++ b/patches/monero/0009-Add-recoverDeterministicWalletFromSpendKey.patch @@ -1,7 +1,7 @@ -From 8db1b159445a8aaca702a8bacb9476abe3aebcf1 Mon Sep 17 00:00:00 2001 +From ff4d7f9500e6aca57a78d94599a70b7823ea6ecd Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Wed, 11 Oct 2023 16:47:59 +0200 -Subject: [PATCH 09/10] Add recoverDeterministicWalletFromSpendKey +Subject: [PATCH 09/16] Add recoverDeterministicWalletFromSpendKey This function is used by Cake Wallet to enable polyseed (dart implementation) support. @@ -19,7 +19,7 @@ Co-authored-by: Godwin Asuquo 5 files changed, 75 insertions(+) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 2fe0d1d29..2411d948c 100644 +index 2106dbd07..ec4ae51ff 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -820,6 +820,35 @@ bool WalletImpl::recover(const std::string &path, const std::string &password, c @@ -149,5 +149,5 @@ index 28fcd36c9..be3ff8184 100644 const std::string &password, NetworkType nettype, -- -2.44.0 +2.39.2 diff --git a/patches/monero/0010-Add-hex-encoding-and-tx-key-getter-for-PendingTransc.patch b/patches/monero/0010-Add-hex-encoding-and-tx-key-getter-for-PendingTransc.patch index 502de5e..e317627 100644 --- a/patches/monero/0010-Add-hex-encoding-and-tx-key-getter-for-PendingTransc.patch +++ b/patches/monero/0010-Add-hex-encoding-and-tx-key-getter-for-PendingTransc.patch @@ -1,7 +1,7 @@ -From db90a0218d581276fcede6f188cc951499095a2f Mon Sep 17 00:00:00 2001 +From 3cc8b1f822f642b574fe38ff27627b362002eab7 Mon Sep 17 00:00:00 2001 From: M Date: Fri, 21 Apr 2023 15:43:47 -0400 -Subject: [PATCH 10/10] Add hex encoding and tx key getter for +Subject: [PATCH 10/16] Add hex encoding and tx key getter for PendingTransction in wallet api. --- @@ -64,5 +64,5 @@ index a585c8212..1c3a11c39 100644 /** -- -2.44.0 +2.39.2 diff --git a/patches/monero/0011-store-crash-fix.patch b/patches/monero/0011-store-crash-fix.patch index dfb96e2..1ddae67 100644 --- a/patches/monero/0011-store-crash-fix.patch +++ b/patches/monero/0011-store-crash-fix.patch @@ -1,7 +1,7 @@ -From 0fe816689af4bce256eae2efa6a8eee0cb8b8097 Mon Sep 17 00:00:00 2001 +From 238c847c153c74953b094d83bfe181a596771d37 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Sat, 11 May 2024 16:25:10 +0200 -Subject: [PATCH] store crash fix +Subject: [PATCH 11/16] store crash fix Monero wallet crashes (sometimes) when it is syncing, while the proper solution (that can be seen in feather) @@ -43,7 +43,7 @@ the current state. 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 2411d948c..90e107137 100644 +index ec4ae51ff..306c9b8ae 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -56,8 +56,8 @@ using namespace cryptonote; @@ -74,7 +74,7 @@ index 2411d948c..90e107137 100644 try { if (path.empty()) { m_wallet->store(); -@@ -2592,10 +2593,10 @@ void WalletImpl::refreshThreadFunc() +@@ -2591,10 +2592,10 @@ void WalletImpl::refreshThreadFunc() } LOG_PRINT_L3(__FUNCTION__ << ": refresh lock acquired..."); @@ -87,7 +87,7 @@ index 2411d948c..90e107137 100644 LOG_PRINT_L3(__FUNCTION__ << ": refreshing..."); doRefresh(); } -@@ -2625,12 +2626,12 @@ void WalletImpl::doRefresh() +@@ -2624,12 +2625,12 @@ void WalletImpl::doRefresh() } m_wallet->find_and_save_rings(false); } else { @@ -102,7 +102,7 @@ index 2411d948c..90e107137 100644 if (m_wallet2Callback->getListener()) { m_wallet2Callback->getListener()->refreshed(); -@@ -2640,9 +2641,9 @@ void WalletImpl::doRefresh() +@@ -2639,9 +2640,9 @@ void WalletImpl::doRefresh() void WalletImpl::startRefresh() { @@ -114,7 +114,7 @@ index 2411d948c..90e107137 100644 m_refreshCV.notify_one(); } } -@@ -2652,7 +2653,7 @@ void WalletImpl::startRefresh() +@@ -2651,7 +2652,7 @@ void WalletImpl::startRefresh() void WalletImpl::stopRefresh() { if (!m_refreshThreadDone) { @@ -123,7 +123,7 @@ index 2411d948c..90e107137 100644 m_refreshThreadDone = true; m_refreshCV.notify_one(); m_refreshThread.join(); -@@ -2663,9 +2664,7 @@ void WalletImpl::pauseRefresh() +@@ -2662,9 +2663,7 @@ void WalletImpl::pauseRefresh() { LOG_PRINT_L2(__FUNCTION__ << ": refresh paused..."); // TODO synchronize access @@ -147,7 +147,7 @@ index d0f443abc..2ad2b62a4 100644 std::atomic m_refreshIntervalMillis; std::atomic m_refreshShouldRescan; diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index 5331f90fc..e5773a26b 100644 +index 61601f70c..4de226a4a 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1203,6 +1203,7 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std @@ -173,7 +173,7 @@ index 5331f90fc..e5773a26b 100644 bool wallet2::set_proxy(const std::string &address) { return m_http_client->set_proxy(address); -@@ -4145,8 +4154,9 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo +@@ -4146,8 +4155,9 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo // infer when we get an incoming output bool first = true, last = false; @@ -185,7 +185,7 @@ index 5331f90fc..e5773a26b 100644 std::vector next_blocks; std::vector next_parsed_blocks; diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index 52886fb85..0d9a9298f 100644 +index fdc1a6212..3ce710433 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -1086,6 +1086,8 @@ private: @@ -206,5 +206,5 @@ index 52886fb85..0d9a9298f 100644 i_wallet2_callback* m_callback; hw::device::device_type m_key_device_type; -- -2.45.0 +2.39.2 diff --git a/patches/monero/0012-WIP-UR-functions.patch b/patches/monero/0012-WIP-UR-functions.patch index d6dc1bd..564be97 100644 --- a/patches/monero/0012-WIP-UR-functions.patch +++ b/patches/monero/0012-WIP-UR-functions.patch @@ -1,7 +1,7 @@ -From f91e92ddaa7c12dcc8f38ac37ff852446bd10722 Mon Sep 17 00:00:00 2001 +From 1b938a3f98468de3fa06b21a458104cf32831586 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Thu, 16 May 2024 17:28:59 +0200 -Subject: [PATCH] WIP: UR functions +Subject: [PATCH 12/16] WIP: UR functions This commit adds UR functions for UR tasks, I believe that the right place to get @@ -283,7 +283,7 @@ index 30065a7fa..a94b23f75 100644 uint64_t minMixinCount() const override; diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 90e107137..ac3e6d51e 100644 +index 306c9b8ae..5ca190c7d 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -48,6 +48,7 @@ @@ -726,10 +726,10 @@ index 1c3a11c39..2bbb32c8b 100644 /*! * \brief scanTransactions - scan a list of transaction ids, this operation may reveal the txids to the remote node and affect your privacy diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index e5773a26b..23b56810e 100644 +index 4de226a4a..7d97e683b 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp -@@ -14051,33 +14051,40 @@ crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::walle +@@ -14056,33 +14056,40 @@ crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::walle bool wallet2::export_key_images(const std::string &filename, bool all) const { @@ -793,7 +793,7 @@ index e5773a26b..23b56810e 100644 //---------------------------------------------------------------------------------------------------- std::pair>> wallet2::export_key_images(bool all) const { -@@ -14132,53 +14139,60 @@ std::pair> +@@ -14137,53 +14144,60 @@ std::pair> return std::make_pair(offset, ski); } @@ -873,7 +873,7 @@ index e5773a26b..23b56810e 100644 ski.push_back(std::make_pair(key_image, signature)); } diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index 0d9a9298f..539d5056c 100644 +index 3ce710433..9ff169a40 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -1650,9 +1650,11 @@ private: diff --git a/patches/monero/0013-android-ndk-version-bump.patch b/patches/monero/0013-android-ndk-version-bump.patch index dce3536..2b741a0 100644 --- a/patches/monero/0013-android-ndk-version-bump.patch +++ b/patches/monero/0013-android-ndk-version-bump.patch @@ -1,7 +1,7 @@ -From 5815bf9d5dd2420915fafb73a3314eb467a489a7 Mon Sep 17 00:00:00 2001 +From 1b978a697e1bdb3144bc08f998d125ac593fa971 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Thu, 23 May 2024 08:02:49 +0200 -Subject: [PATCH] android ndk version bump +Subject: [PATCH 13/16] android ndk version bump --- contrib/depends/hosts/android.mk | 16 +++++++++++++--- diff --git a/patches/monero/0013-rename-arm-armv7a.patch b/patches/monero/0014-rename-arm-armv7a.patch similarity index 97% rename from patches/monero/0013-rename-arm-armv7a.patch rename to patches/monero/0014-rename-arm-armv7a.patch index 7049065..20e2822 100644 --- a/patches/monero/0013-rename-arm-armv7a.patch +++ b/patches/monero/0014-rename-arm-armv7a.patch @@ -1,7 +1,7 @@ -From 9b7623e565a31db296f20cac00ddde58e8e83fe2 Mon Sep 17 00:00:00 2001 +From 2dfa0442a096f61fe16a5bc569a4d0ab9ddb7de5 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Wed, 12 Jun 2024 15:48:01 +0200 -Subject: [PATCH] rename arm -> armv7a +Subject: [PATCH 14/16] rename arm -> armv7a --- contrib/depends/hosts/android.mk | 2 +- diff --git a/patches/monero/0014-use-proper-error-handling-in-get_seed.patch b/patches/monero/0015-use-proper-error-handling-in-get_seed.patch similarity index 92% rename from patches/monero/0014-use-proper-error-handling-in-get_seed.patch rename to patches/monero/0015-use-proper-error-handling-in-get_seed.patch index 892a827..aef7dcf 100644 --- a/patches/monero/0014-use-proper-error-handling-in-get_seed.patch +++ b/patches/monero/0015-use-proper-error-handling-in-get_seed.patch @@ -1,7 +1,7 @@ -From 50e09195fcb79debf5951c69717b9d4f239ed8e1 Mon Sep 17 00:00:00 2001 +From 6e7a9770e4f18f931f5caca7dec2a197e779afbc Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Mon, 24 Jun 2024 10:49:12 +0200 -Subject: [PATCH] use proper error handling in get_seed +Subject: [PATCH 15/16] use proper error handling in get_seed --- src/wallet/api/wallet.cpp | 17 ++++++++++++----- @@ -9,7 +9,7 @@ Subject: [PATCH] use proper error handling in get_seed 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index ac3e6d51e..8bdd75a5a 100644 +index 5ca190c7d..a307d35a7 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -880,12 +880,19 @@ bool WalletImpl::close(bool store) @@ -38,7 +38,7 @@ index ac3e6d51e..8bdd75a5a 100644 bool WalletImpl::getPolyseed(std::string &seed_words, std::string &passphrase) const diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index 23b56810e..f7bdf2429 100644 +index 7d97e683b..8e44806fc 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1452,11 +1452,13 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab diff --git a/patches/monero/0015-add-dummy-device-for-ledger.patch b/patches/monero/0016-add-dummy-device-for-ledger.patch similarity index 98% rename from patches/monero/0015-add-dummy-device-for-ledger.patch rename to patches/monero/0016-add-dummy-device-for-ledger.patch index 4f88774..d4ab5fe 100644 --- a/patches/monero/0015-add-dummy-device-for-ledger.patch +++ b/patches/monero/0016-add-dummy-device-for-ledger.patch @@ -1,7 +1,7 @@ -From 07f41c8afda9eafca519d44f5c6c34316f5ebb71 Mon Sep 17 00:00:00 2001 +From 6b40191d35df998280e1d6e19ff9bf4bce54d5bf Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Wed, 26 Jun 2024 15:04:38 +0200 -Subject: [PATCH] add dummy device for ledger +Subject: [PATCH 16/16] add dummy device for ledger --- CMakeLists.txt | 6 +- @@ -414,7 +414,7 @@ index 03058c4f1..506f27c4a 100644 unsigned char buffer_send[BUFFER_SEND_SIZE]; unsigned int length_recv; diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 8bdd75a5a..d8661b213 100644 +index a307d35a7..3ead385ec 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -49,6 +49,9 @@ @@ -427,7 +427,7 @@ index 8bdd75a5a..d8661b213 100644 using namespace std; using namespace cryptonote; -@@ -3299,4 +3302,94 @@ uint64_t WalletImpl::getBytesSent() +@@ -3298,4 +3301,94 @@ uint64_t WalletImpl::getBytesSent() return m_wallet->get_bytes_sent(); } diff --git a/patches/monero/0017-added-deps.patch b/patches/monero/0017-added-deps.patch new file mode 100644 index 0000000..4edacce --- /dev/null +++ b/patches/monero/0017-added-deps.patch @@ -0,0 +1,29 @@ +From 8f0b07a685b5971f4deb66bb8c53e6da4065370c Mon Sep 17 00:00:00 2001 +From: cyan +Date: Thu, 25 Jul 2024 20:06:29 +0000 +Subject: [PATCH] added deps + +--- + external/polyseed | 1 + + external/utf8proc | 1 + + 2 files changed, 2 insertions(+) + create mode 160000 external/polyseed + create mode 160000 external/utf8proc + +diff --git a/external/polyseed b/external/polyseed +new file mode 160000 +index 000000000..dfb05d8ed +--- /dev/null ++++ b/external/polyseed +@@ -0,0 +1 @@ ++Subproject commit dfb05d8edb682b0e8f743b1b70c9131712ff4157 +diff --git a/external/utf8proc b/external/utf8proc +new file mode 160000 +index 000000000..5568eff49 +--- /dev/null ++++ b/external/utf8proc +@@ -0,0 +1 @@ ++Subproject commit 5568eff49a6bf417b6fdef2808df9db8d3d68a76 +-- +2.39.2 +