diff --git a/patches/monero/0002-wallet-background-sync-with-just-the-view-key.patch b/patches/monero/0001-wallet-background-sync-with-just-the-view-key.patch similarity index 94% rename from patches/monero/0002-wallet-background-sync-with-just-the-view-key.patch rename to patches/monero/0001-wallet-background-sync-with-just-the-view-key.patch index 16fe77fc..c9fc999d 100644 --- a/patches/monero/0002-wallet-background-sync-with-just-the-view-key.patch +++ b/patches/monero/0001-wallet-background-sync-with-just-the-view-key.patch @@ -1,7 +1,7 @@ -From 56fed429a25773c760b8490b3e0fb908c832e6e5 Mon Sep 17 00:00:00 2001 +From 958a56330836f5185a29d022a6696956ec78a8d6 Mon Sep 17 00:00:00 2001 From: j-berman Date: Thu, 13 Oct 2022 18:33:33 -0700 -Subject: [PATCH 02/16] wallet: background sync with just the view key +Subject: [PATCH 01/11] 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,12 +30,12 @@ cache. src/cryptonote_basic/account.cpp | 11 + src/cryptonote_basic/account.h | 1 + src/cryptonote_config.h | 2 + - src/simplewallet/simplewallet.cpp | 203 +++- + src/simplewallet/simplewallet.cpp | 204 +++- src/simplewallet/simplewallet.h | 1 + src/wallet/api/wallet.cpp | 213 +++- src/wallet/api/wallet.h | 12 + src/wallet/api/wallet2_api.h | 42 + - src/wallet/wallet2.cpp | 1029 ++++++++++++++++-- + src/wallet/wallet2.cpp | 1030 ++++++++++++++++-- src/wallet/wallet2.h | 156 ++- src/wallet/wallet_errors.h | 39 + src/wallet/wallet_rpc_server.cpp | 162 +++ @@ -47,14 +47,14 @@ cache. tests/functional_tests/wallet.py | 43 +- tests/unit_tests/wipeable_string.cpp | 12 + utils/python-rpc/framework/wallet.py | 42 + - 20 files changed, 2335 insertions(+), 130 deletions(-) + 20 files changed, 2337 insertions(+), 130 deletions(-) diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp -index 4931c3740..2d556f285 100644 +index 2ac455fda..4e87d4477 100644 --- a/src/cryptonote_basic/account.cpp +++ b/src/cryptonote_basic/account.cpp -@@ -158,6 +158,17 @@ DISABLE_VS_WARNINGS(4244 4345) - m_keys.m_passphrase.wipe(); +@@ -152,6 +152,17 @@ DISABLE_VS_WARNINGS(4244 4345) + m_keys.m_multisig_keys.clear(); } //----------------------------------------------------------------- + void account_base::set_spend_key(const crypto::secret_key& spend_secret_key) @@ -72,10 +72,10 @@ index 4931c3740..2d556f285 100644 { crypto::secret_key first = generate_keys(m_keys.m_account_address.m_spend_public_key, m_keys.m_spend_secret_key, recovery_key, recover); diff --git a/src/cryptonote_basic/account.h b/src/cryptonote_basic/account.h -index 0099ebfe7..1f76febce 100644 +index 2ee9545d4..93d1d28f0 100644 --- a/src/cryptonote_basic/account.h +++ b/src/cryptonote_basic/account.h -@@ -101,6 +101,7 @@ namespace cryptonote +@@ -95,6 +95,7 @@ namespace cryptonote bool store(const std::string& file_path); void forget_spend_key(); @@ -84,10 +84,10 @@ index 0099ebfe7..1f76febce 100644 void encrypt_keys(const crypto::chacha_key &key) { m_keys.encrypt(key); } diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h -index 8e1a07110..3af3a63a1 100644 +index 61146a114..f9e6a6cb9 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h -@@ -243,6 +243,8 @@ namespace config +@@ -241,6 +241,8 @@ namespace config const unsigned char HASH_KEY_ENCRYPTED_PAYMENT_ID = 0x8d; const unsigned char HASH_KEY_WALLET = 0x8c; const unsigned char HASH_KEY_WALLET_CACHE = 0x8d; @@ -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 b9e30f9d9..f8ed6659c 100644 +index b9e30f9d9..2c51337ef 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -155,6 +155,17 @@ typedef cryptonote::simple_wallet sw; @@ -229,7 +229,7 @@ index b9e30f9d9..f8ed6659c 100644 if (args.empty()) { size_t ntd = m_wallet->get_num_transfer_details(); -@@ -3005,6 +3062,56 @@ bool simple_wallet::set_track_uses(const std::vector &args/* = std: +@@ -3005,6 +3062,57 @@ bool simple_wallet::set_track_uses(const std::vector &args/* = std: return true; } @@ -251,42 +251,43 @@ index b9e30f9d9..f8ed6659c 100644 + return true; + } + -+ const auto pwd_container = get_and_verify_password(); -+ if (pwd_container) ++ tools::wallet2::BackgroundSyncType background_sync_type; ++ if (!parse_background_sync_type(args[1], background_sync_type)) + { -+ tools::wallet2::BackgroundSyncType background_sync_type; -+ if (!parse_background_sync_type(args[1], background_sync_type)) -+ { -+ fail_msg_writer() << tr("invalid option"); -+ return true; -+ } ++ fail_msg_writer() << tr("invalid option"); ++ return true; ++ } + -+ try -+ { -+ boost::optional background_cache_password = boost::none; -+ if (background_sync_type == tools::wallet2::BackgroundSyncCustomPassword) -+ { -+ const auto background_pwd_container = background_sync_cache_password_prompter(true); -+ if (!background_pwd_container) -+ return true; -+ background_cache_password = background_pwd_container->password(); -+ } ++ const auto pwd_container = get_and_verify_password(); ++ if (!pwd_container) ++ return true; + -+ LOCK_IDLE_SCOPE(); -+ m_wallet->setup_background_sync(background_sync_type, pwd_container->password(), background_cache_password); -+ } -+ catch (const std::exception &e) ++ try ++ { ++ boost::optional background_cache_password = boost::none; ++ if (background_sync_type == tools::wallet2::BackgroundSyncCustomPassword) + { -+ fail_msg_writer() << tr("Error setting background sync type: ") << e.what(); ++ const auto background_pwd_container = background_sync_cache_password_prompter(true); ++ if (!background_pwd_container) ++ return true; ++ background_cache_password = background_pwd_container->password(); + } ++ ++ LOCK_IDLE_SCOPE(); ++ m_wallet->setup_background_sync(background_sync_type, pwd_container->password(), background_cache_password); + } ++ catch (const std::exception &e) ++ { ++ fail_msg_writer() << tr("Error setting background sync type: ") << e.what(); ++ } ++ + return true; +} + bool simple_wallet::set_show_wallet_name_when_locked(const std::vector &args/* = std::vector()*/) { const auto pwd_container = get_and_verify_password(); -@@ -3237,6 +3344,7 @@ bool simple_wallet::apropos(const std::vector &args) +@@ -3237,6 +3345,7 @@ bool simple_wallet::apropos(const std::vector &args) bool simple_wallet::scan_tx(const std::vector &args) { @@ -294,7 +295,7 @@ index b9e30f9d9..f8ed6659c 100644 if (args.empty()) { PRINT_USAGE(USAGE_SCAN_TX); -@@ -3458,6 +3566,8 @@ simple_wallet::simple_wallet() +@@ -3458,6 +3567,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 +304,7 @@ index b9e30f9d9..f8ed6659c 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 " -@@ -3876,6 +3986,7 @@ bool simple_wallet::set_variable(const std::vector &args) +@@ -3876,6 +3987,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 +312,7 @@ index b9e30f9d9..f8ed6659c 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"); -@@ -3894,6 +4005,7 @@ bool simple_wallet::set_variable(const std::vector &args) +@@ -3894,6 +4006,7 @@ bool simple_wallet::set_variable(const std::vector &args) } else { @@ -319,7 +320,7 @@ index b9e30f9d9..f8ed6659c 100644 #define CHECK_SIMPLE_VARIABLE(name, f, help) do \ if (args[0] == name) { \ -@@ -3947,6 +4059,7 @@ bool simple_wallet::set_variable(const std::vector &args) +@@ -3947,6 +4060,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 +328,7 @@ index b9e30f9d9..f8ed6659c 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")); -@@ -4900,7 +5013,10 @@ std::string simple_wallet::get_mnemonic_language() +@@ -4900,7 +5014,10 @@ std::string simple_wallet::get_mnemonic_language() //---------------------------------------------------------------------------------------------------- boost::optional simple_wallet::get_and_verify_password() const { @@ -339,7 +340,7 @@ index b9e30f9d9..f8ed6659c 100644 if (!pwd_container) return boost::none; -@@ -5203,6 +5319,8 @@ boost::optional simple_wallet::open_wallet(const boost::p +@@ -5203,6 +5320,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 +349,7 @@ index b9e30f9d9..f8ed6659c 100644 else prefix = tr("Opened wallet"); message_writer(console_color_white, true) << -@@ -5411,6 +5529,10 @@ void simple_wallet::stop_background_mining() +@@ -5411,6 +5530,10 @@ void simple_wallet::stop_background_mining() //---------------------------------------------------------------------------------------------------- void simple_wallet::check_background_mining(const epee::wipeable_string &password) { @@ -359,7 +360,7 @@ index b9e30f9d9..f8ed6659c 100644 tools::wallet2::BackgroundMiningSetupType setup = m_wallet->setup_background_mining(); if (setup == tools::wallet2::BackgroundMiningNo) { -@@ -6275,6 +6397,7 @@ bool simple_wallet::show_blockchain_height(const std::vector& args) +@@ -6275,6 +6398,7 @@ bool simple_wallet::show_blockchain_height(const std::vector& args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::rescan_spent(const std::vector &args) { @@ -367,7 +368,7 @@ index b9e30f9d9..f8ed6659c 100644 if (!m_wallet->is_trusted_daemon()) { fail_msg_writer() << tr("this command requires a trusted daemon. Enable with --trusted-daemon"); -@@ -6532,10 +6655,27 @@ void simple_wallet::check_for_inactivity_lock(bool user) +@@ -6532,10 +6656,27 @@ void simple_wallet::check_for_inactivity_lock(bool user) " || ||" << std::endl << "" << std::endl; } @@ -396,7 +397,7 @@ index b9e30f9d9..f8ed6659c 100644 const bool show_wallet_name = m_wallet->show_wallet_name_when_locked(); if (show_wallet_name) -@@ -6548,8 +6688,16 @@ void simple_wallet::check_for_inactivity_lock(bool user) +@@ -6548,8 +6689,16 @@ void simple_wallet::check_for_inactivity_lock(bool user) } try { @@ -414,7 +415,7 @@ index b9e30f9d9..f8ed6659c 100644 } catch (...) { /* do nothing, just let the loop loop */ } } -@@ -6576,6 +6724,7 @@ bool simple_wallet::on_command(bool (simple_wallet::*cmd)(const std::vector &args_, bool called_by_mms) { // "transfer [index=[,,...]] [] []
[]" @@ -422,7 +423,7 @@ index b9e30f9d9..f8ed6659c 100644 if (!try_connect_to_daemon()) return false; -@@ -7004,6 +7153,7 @@ bool simple_wallet::transfer_main(const std::vector &args_, bool ca +@@ -7004,6 +7154,7 @@ bool simple_wallet::transfer_main(const std::vector &args_, bool ca //---------------------------------------------------------------------------------------------------- bool simple_wallet::transfer(const std::vector &args_) { @@ -430,7 +431,7 @@ index b9e30f9d9..f8ed6659c 100644 if (args_.size() < 1) { PRINT_USAGE(USAGE_TRANSFER); -@@ -7016,6 +7166,7 @@ bool simple_wallet::transfer(const std::vector &args_) +@@ -7016,6 +7167,7 @@ bool simple_wallet::transfer(const std::vector &args_) bool simple_wallet::sweep_unmixable(const std::vector &args_) { @@ -438,7 +439,7 @@ index b9e30f9d9..f8ed6659c 100644 if (!try_connect_to_daemon()) return true; -@@ -7123,6 +7274,7 @@ bool simple_wallet::sweep_unmixable(const std::vector &args_) +@@ -7123,6 +7275,7 @@ bool simple_wallet::sweep_unmixable(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::sweep_main(uint32_t account, uint64_t below, const std::vector &args_) { @@ -446,7 +447,7 @@ index b9e30f9d9..f8ed6659c 100644 auto print_usage = [this, account, below]() { if (below) -@@ -7404,6 +7556,7 @@ bool simple_wallet::sweep_main(uint32_t account, uint64_t below, const std::vect +@@ -7404,6 +7557,7 @@ bool simple_wallet::sweep_main(uint32_t account, uint64_t below, const std::vect //---------------------------------------------------------------------------------------------------- bool simple_wallet::sweep_single(const std::vector &args_) { @@ -454,7 +455,7 @@ index b9e30f9d9..f8ed6659c 100644 if (!try_connect_to_daemon()) return true; -@@ -7642,12 +7795,14 @@ bool simple_wallet::sweep_single(const std::vector &args_) +@@ -7642,12 +7796,14 @@ bool simple_wallet::sweep_single(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::sweep_all(const std::vector &args_) { @@ -469,7 +470,7 @@ index b9e30f9d9..f8ed6659c 100644 auto local_args = args_; if (local_args.empty()) { -@@ -7668,6 +7823,7 @@ bool simple_wallet::sweep_account(const std::vector &args_) +@@ -7668,6 +7824,7 @@ bool simple_wallet::sweep_account(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::sweep_below(const std::vector &args_) { @@ -477,7 +478,7 @@ index b9e30f9d9..f8ed6659c 100644 uint64_t below = 0; if (args_.size() < 1) { -@@ -7686,6 +7842,7 @@ bool simple_wallet::sweep_below(const std::vector &args_) +@@ -7686,6 +7843,7 @@ bool simple_wallet::sweep_below(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::donate(const std::vector &args_) { @@ -485,7 +486,7 @@ index b9e30f9d9..f8ed6659c 100644 std::vector local_args = args_; if(local_args.empty() || local_args.size() > 5) { -@@ -7747,6 +7904,7 @@ bool simple_wallet::donate(const std::vector &args_) +@@ -7747,6 +7905,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) { @@ -493,7 +494,7 @@ index b9e30f9d9..f8ed6659c 100644 // gather info to ask the user uint64_t amount = 0, amount_to_dests = 0, change = 0; size_t min_ring_size = ~0; -@@ -7927,6 +8085,7 @@ bool simple_wallet::sign_transfer(const std::vector &args_) +@@ -7927,6 +8086,7 @@ bool simple_wallet::sign_transfer(const std::vector &args_) fail_msg_writer() << tr("This is a watch only wallet"); return true; } @@ -501,7 +502,7 @@ index b9e30f9d9..f8ed6659c 100644 bool export_raw = false; std::string unsigned_filename = "unsigned_monero_tx"; -@@ -8034,6 +8193,8 @@ std::string get_tx_key_stream(crypto::secret_key tx_key, std::vector &args_) { @@ -510,7 +511,7 @@ index b9e30f9d9..f8ed6659c 100644 std::vector local_args = args_; if (m_wallet->key_on_device() && m_wallet->get_account().get_device().get_type() != hw::device::TREZOR) -@@ -8074,6 +8235,8 @@ bool simple_wallet::get_tx_key(const std::vector &args_) +@@ -8074,6 +8236,8 @@ bool simple_wallet::get_tx_key(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::set_tx_key(const std::vector &args_) { @@ -519,7 +520,7 @@ index b9e30f9d9..f8ed6659c 100644 std::vector local_args = args_; if(local_args.size() != 2 && local_args.size() != 3) { -@@ -8150,6 +8313,8 @@ bool simple_wallet::set_tx_key(const std::vector &args_) +@@ -8150,6 +8314,8 @@ bool simple_wallet::set_tx_key(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_tx_proof(const std::vector &args) { @@ -528,7 +529,7 @@ index b9e30f9d9..f8ed6659c 100644 if (args.size() != 2 && args.size() != 3) { PRINT_USAGE(USAGE_GET_TX_PROOF); -@@ -8356,6 +8521,7 @@ bool simple_wallet::check_tx_proof(const std::vector &args) +@@ -8356,6 +8522,7 @@ bool simple_wallet::check_tx_proof(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_spend_proof(const std::vector &args) { @@ -536,7 +537,7 @@ index b9e30f9d9..f8ed6659c 100644 if (m_wallet->key_on_device()) { fail_msg_writer() << tr("command not supported by HW wallet"); -@@ -8440,6 +8606,7 @@ bool simple_wallet::check_spend_proof(const std::vector &args) +@@ -8440,6 +8607,7 @@ bool simple_wallet::check_spend_proof(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_reserve_proof(const std::vector &args) { @@ -544,7 +545,7 @@ index b9e30f9d9..f8ed6659c 100644 if (m_wallet->key_on_device()) { fail_msg_writer() << tr("command not supported by HW wallet"); -@@ -9126,6 +9293,8 @@ bool simple_wallet::unspent_outputs(const std::vector &args_) +@@ -9126,6 +9294,8 @@ bool simple_wallet::unspent_outputs(const std::vector &args_) //---------------------------------------------------------------------------------------------------- bool simple_wallet::rescan_blockchain(const std::vector &args_) { @@ -553,7 +554,7 @@ index b9e30f9d9..f8ed6659c 100644 uint64_t start_height = 0; ResetType reset_type = ResetSoft; -@@ -9423,6 +9592,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9423,6 +9593,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector if (command == "new") { // create a new account and switch to it @@ -561,7 +562,7 @@ index b9e30f9d9..f8ed6659c 100644 std::string label = boost::join(local_args, " "); if (label.empty()) label = tr("(Untitled account)"); -@@ -9453,6 +9623,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9453,6 +9624,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 @@ -569,7 +570,7 @@ index b9e30f9d9..f8ed6659c 100644 uint32_t index_major; if (!epee::string_tools::get_xtype_from_string(index_major, local_args[0])) { -@@ -9474,6 +9645,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9474,6 +9646,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector } else if (command == "tag" && local_args.size() >= 2) { @@ -577,7 +578,7 @@ index b9e30f9d9..f8ed6659c 100644 const std::string tag = local_args[0]; std::set account_indices; for (size_t i = 1; i < local_args.size(); ++i) -@@ -9498,6 +9670,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9498,6 +9671,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector } else if (command == "untag" && local_args.size() >= 1) { @@ -585,7 +586,7 @@ index b9e30f9d9..f8ed6659c 100644 std::set account_indices; for (size_t i = 0; i < local_args.size(); ++i) { -@@ -9521,6 +9694,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector +@@ -9521,6 +9695,7 @@ bool simple_wallet::account(const std::vector &args/* = std::vector } else if (command == "tag_description" && local_args.size() >= 1) { @@ -593,7 +594,7 @@ index b9e30f9d9..f8ed6659c 100644 const std::string tag = local_args[0]; std::string description; if (local_args.size() > 1) -@@ -9638,6 +9812,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: +@@ -9638,6 +9813,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: } else if (local_args[0] == "new") { @@ -601,7 +602,7 @@ index b9e30f9d9..f8ed6659c 100644 local_args.erase(local_args.begin()); std::string label; if (local_args.size() > 0) -@@ -9650,6 +9825,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: +@@ -9650,6 +9826,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: } else if (local_args[0] == "mnew") { @@ -609,7 +610,7 @@ index b9e30f9d9..f8ed6659c 100644 local_args.erase(local_args.begin()); if (local_args.size() != 1) { -@@ -9675,6 +9851,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: +@@ -9675,6 +9852,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: } else if (local_args[0] == "one-off") { @@ -617,7 +618,7 @@ index b9e30f9d9..f8ed6659c 100644 local_args.erase(local_args.begin()); std::string label; if (local_args.size() != 2) -@@ -9693,6 +9870,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: +@@ -9693,6 +9871,7 @@ bool simple_wallet::print_address(const std::vector &args/* = std:: } else if (local_args.size() >= 2 && local_args[0] == "label") { @@ -625,7 +626,7 @@ index b9e30f9d9..f8ed6659c 100644 if (!epee::string_tools::get_xtype_from_string(index, local_args[1])) { fail_msg_writer() << tr("failed to parse index: ") << local_args[1]; -@@ -9839,6 +10017,8 @@ bool simple_wallet::print_integrated_address(const std::vector &arg +@@ -9839,6 +10018,8 @@ bool simple_wallet::print_integrated_address(const std::vector &arg //---------------------------------------------------------------------------------------------------- bool simple_wallet::address_book(const std::vector &args/* = std::vector()*/) { @@ -634,7 +635,7 @@ index b9e30f9d9..f8ed6659c 100644 if (args.size() == 0) { } -@@ -9899,6 +10079,8 @@ bool simple_wallet::address_book(const std::vector &args/* = std::v +@@ -9899,6 +10080,8 @@ bool simple_wallet::address_book(const std::vector &args/* = std::v //---------------------------------------------------------------------------------------------------- bool simple_wallet::set_tx_note(const std::vector &args) { @@ -643,7 +644,7 @@ index b9e30f9d9..f8ed6659c 100644 if (args.size() == 0) { PRINT_USAGE(USAGE_SET_TX_NOTE); -@@ -9927,6 +10109,8 @@ bool simple_wallet::set_tx_note(const std::vector &args) +@@ -9927,6 +10110,8 @@ bool simple_wallet::set_tx_note(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_tx_note(const std::vector &args) { @@ -652,7 +653,7 @@ index b9e30f9d9..f8ed6659c 100644 if (args.size() != 1) { PRINT_USAGE(USAGE_GET_TX_NOTE); -@@ -9952,6 +10136,8 @@ bool simple_wallet::get_tx_note(const std::vector &args) +@@ -9952,6 +10137,8 @@ bool simple_wallet::get_tx_note(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::set_description(const std::vector &args) { @@ -661,7 +662,7 @@ index b9e30f9d9..f8ed6659c 100644 // 0 arguments allowed, for setting the description to empty string std::string description = ""; -@@ -9968,6 +10154,8 @@ bool simple_wallet::set_description(const std::vector &args) +@@ -9968,6 +10155,8 @@ bool simple_wallet::set_description(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::get_description(const std::vector &args) { @@ -670,7 +671,7 @@ index b9e30f9d9..f8ed6659c 100644 if (args.size() != 0) { PRINT_USAGE(USAGE_GET_DESCRIPTION); -@@ -10026,6 +10214,8 @@ bool simple_wallet::wallet_info(const std::vector &args) +@@ -10026,6 +10215,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(); @@ -679,7 +680,7 @@ index b9e30f9d9..f8ed6659c 100644 else type = tr("Normal"); message_writer() << tr("Type: ") << type; -@@ -10037,6 +10227,7 @@ bool simple_wallet::wallet_info(const std::vector &args) +@@ -10037,6 +10228,7 @@ bool simple_wallet::wallet_info(const std::vector &args) //---------------------------------------------------------------------------------------------------- bool simple_wallet::sign(const std::vector &args) { @@ -687,7 +688,7 @@ index b9e30f9d9..f8ed6659c 100644 if (m_wallet->key_on_device()) { fail_msg_writer() << tr("command not supported by HW wallet"); -@@ -10144,6 +10335,7 @@ bool simple_wallet::export_key_images(const std::vector &args_) +@@ -10144,6 +10336,7 @@ bool simple_wallet::export_key_images(const std::vector &args_) fail_msg_writer() << tr("command not supported by HW wallet"); return true; } @@ -695,7 +696,7 @@ index b9e30f9d9..f8ed6659c 100644 auto args = args_; if (m_wallet->watch_only()) -@@ -10197,6 +10389,7 @@ bool simple_wallet::import_key_images(const std::vector &args) +@@ -10197,6 +10390,7 @@ bool simple_wallet::import_key_images(const std::vector &args) fail_msg_writer() << tr("command not supported by HW wallet"); return true; } @@ -703,7 +704,7 @@ index b9e30f9d9..f8ed6659c 100644 if (!m_wallet->is_trusted_daemon()) { fail_msg_writer() << tr("this command requires a trusted daemon. Enable with --trusted-daemon"); -@@ -10305,6 +10498,7 @@ bool simple_wallet::export_outputs(const std::vector &args_) +@@ -10305,6 +10499,7 @@ bool simple_wallet::export_outputs(const std::vector &args_) fail_msg_writer() << tr("command not supported by HW wallet"); return true; } @@ -711,7 +712,7 @@ index b9e30f9d9..f8ed6659c 100644 auto args = args_; bool all = false; -@@ -10354,6 +10548,7 @@ bool simple_wallet::import_outputs(const std::vector &args) +@@ -10354,6 +10549,7 @@ bool simple_wallet::import_outputs(const std::vector &args) fail_msg_writer() << tr("command not supported by HW wallet"); return true; } @@ -732,7 +733,7 @@ index 652708f5a..159da2c45 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 d96ea97ea..7d430b655 100644 +index fc4f89128..e9f76f4cf 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -54,6 +54,40 @@ using namespace cryptonote; @@ -776,7 +777,7 @@ index d96ea97ea..7d430b655 100644 namespace Monero { namespace { -@@ -814,6 +848,8 @@ bool WalletImpl::close(bool store) +@@ -792,6 +826,8 @@ bool WalletImpl::close(bool store) std::string WalletImpl::seed(const std::string& seed_offset) const { @@ -785,7 +786,7 @@ index d96ea97ea..7d430b655 100644 epee::wipeable_string seed; if (m_wallet) m_wallet->get_seed(seed, seed_offset); -@@ -876,6 +912,8 @@ std::string WalletImpl::getSeedLanguage() const +@@ -805,6 +841,8 @@ std::string WalletImpl::getSeedLanguage() const void WalletImpl::setSeedLanguage(const std::string &arg) { @@ -794,7 +795,7 @@ index d96ea97ea..7d430b655 100644 m_wallet->set_seed_language(arg); } -@@ -899,6 +937,8 @@ void WalletImpl::statusWithErrorString(int& status, std::string& errorString) co +@@ -828,6 +866,8 @@ void WalletImpl::statusWithErrorString(int& status, std::string& errorString) co bool WalletImpl::setPassword(const std::string &password) { @@ -803,7 +804,7 @@ index d96ea97ea..7d430b655 100644 clearStatus(); try { m_wallet->change_password(m_wallet->get_wallet_file(), m_password, password); -@@ -1059,6 +1099,8 @@ bool WalletImpl::lightWalletImportWalletRequest(std::string &payment_id, uint64_ +@@ -988,6 +1028,8 @@ bool WalletImpl::lightWalletImportWalletRequest(std::string &payment_id, uint64_ void WalletImpl::setRefreshFromBlockHeight(uint64_t refresh_from_block_height) { @@ -812,7 +813,7 @@ index d96ea97ea..7d430b655 100644 m_wallet->set_refresh_from_block_height(refresh_from_block_height); } -@@ -1176,6 +1218,8 @@ void WalletImpl::refreshAsync() +@@ -1105,6 +1147,8 @@ void WalletImpl::refreshAsync() bool WalletImpl::rescanBlockchain() { @@ -821,7 +822,7 @@ index d96ea97ea..7d430b655 100644 clearStatus(); m_refreshShouldRescan = true; doRefresh(); -@@ -1184,6 +1228,8 @@ bool WalletImpl::rescanBlockchain() +@@ -1113,6 +1157,8 @@ bool WalletImpl::rescanBlockchain() void WalletImpl::rescanBlockchainAsync() { @@ -830,7 +831,7 @@ index d96ea97ea..7d430b655 100644 m_refreshShouldRescan = true; refreshAsync(); } -@@ -1207,7 +1253,7 @@ int WalletImpl::autoRefreshInterval() const +@@ -1136,7 +1182,7 @@ int WalletImpl::autoRefreshInterval() const UnsignedTransaction *WalletImpl::loadUnsignedTx(const std::string &unsigned_filename) { clearStatus(); UnsignedTransactionImpl * transaction = new UnsignedTransactionImpl(*this); @@ -839,7 +840,7 @@ index d96ea97ea..7d430b655 100644 setStatusError(tr("Failed to load unsigned transactions")); transaction->m_status = UnsignedTransaction::Status::Status_Error; transaction->m_errorString = errorString(); -@@ -1227,6 +1273,8 @@ UnsignedTransaction *WalletImpl::loadUnsignedTx(const std::string &unsigned_file +@@ -1156,6 +1202,8 @@ UnsignedTransaction *WalletImpl::loadUnsignedTx(const std::string &unsigned_file bool WalletImpl::submitTransaction(const string &fileName) { clearStatus(); @@ -848,7 +849,7 @@ index d96ea97ea..7d430b655 100644 std::unique_ptr transaction(new PendingTransactionImpl(*this)); bool r = m_wallet->load_tx(fileName, transaction->m_pending_tx); -@@ -1250,6 +1298,8 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) +@@ -1179,6 +1227,8 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) setStatusError(tr("Wallet is view only")); return false; } @@ -857,7 +858,7 @@ index d96ea97ea..7d430b655 100644 try { -@@ -1270,6 +1320,8 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) +@@ -1199,6 +1249,8 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) bool WalletImpl::importKeyImages(const string &filename) { @@ -866,7 +867,7 @@ index d96ea97ea..7d430b655 100644 if (!trustedDaemon()) { setStatusError(tr("Key images can only be imported with a trusted daemon")); return false; -@@ -1293,6 +1345,8 @@ bool WalletImpl::importKeyImages(const string &filename) +@@ -1222,6 +1274,8 @@ bool WalletImpl::importKeyImages(const string &filename) bool WalletImpl::exportOutputs(const string &filename, bool all) { @@ -875,7 +876,7 @@ index d96ea97ea..7d430b655 100644 if (m_wallet->key_on_device()) { setStatusError(string(tr("Not supported on HW wallets.")) + filename); -@@ -1323,6 +1377,8 @@ bool WalletImpl::exportOutputs(const string &filename, bool all) +@@ -1252,6 +1306,8 @@ bool WalletImpl::exportOutputs(const string &filename, bool all) bool WalletImpl::importOutputs(const string &filename) { @@ -884,7 +885,7 @@ index d96ea97ea..7d430b655 100644 if (m_wallet->key_on_device()) { setStatusError(string(tr("Not supported on HW wallets.")) + filename); -@@ -1355,6 +1411,8 @@ bool WalletImpl::importOutputs(const string &filename) +@@ -1284,6 +1340,8 @@ bool WalletImpl::importOutputs(const string &filename) bool WalletImpl::scanTransactions(const std::vector &txids) { @@ -893,7 +894,7 @@ index d96ea97ea..7d430b655 100644 if (txids.empty()) { setStatusError(string(tr("Failed to scan transactions: no transaction ids provided."))); -@@ -1393,8 +1451,86 @@ bool WalletImpl::scanTransactions(const std::vector &txids) +@@ -1322,8 +1380,86 @@ bool WalletImpl::scanTransactions(const std::vector &txids) return true; } @@ -980,7 +981,7 @@ index d96ea97ea..7d430b655 100644 m_wallet->add_subaddress_account(label); } size_t WalletImpl::numSubaddressAccounts() const -@@ -1407,10 +1543,14 @@ size_t WalletImpl::numSubaddresses(uint32_t accountIndex) const +@@ -1336,10 +1472,14 @@ size_t WalletImpl::numSubaddresses(uint32_t accountIndex) const } void WalletImpl::addSubaddress(uint32_t accountIndex, const std::string& label) { @@ -995,7 +996,7 @@ index d96ea97ea..7d430b655 100644 try { return m_wallet->get_subaddress_label({accountIndex, addressIndex}); -@@ -1424,6 +1564,8 @@ std::string WalletImpl::getSubaddressLabel(uint32_t accountIndex, uint32_t addre +@@ -1353,6 +1493,8 @@ std::string WalletImpl::getSubaddressLabel(uint32_t accountIndex, uint32_t addre } void WalletImpl::setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) { @@ -1004,7 +1005,7 @@ index d96ea97ea..7d430b655 100644 try { return m_wallet->set_subaddress_label({accountIndex, addressIndex}, label); -@@ -1437,12 +1579,16 @@ void WalletImpl::setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex +@@ -1366,12 +1508,16 @@ void WalletImpl::setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex MultisigState WalletImpl::multisig() const { MultisigState state; @@ -1021,7 +1022,7 @@ index d96ea97ea..7d430b655 100644 try { clearStatus(); return m_wallet->get_multisig_first_kex_msg(); -@@ -1455,6 +1601,8 @@ string WalletImpl::getMultisigInfo() const { +@@ -1384,6 +1530,8 @@ string WalletImpl::getMultisigInfo() const { } string WalletImpl::makeMultisig(const vector& info, const uint32_t threshold) { @@ -1030,7 +1031,7 @@ index d96ea97ea..7d430b655 100644 try { clearStatus(); -@@ -1595,6 +1743,9 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector extra; std::string extra_nonce; vector dsts; -@@ -1761,6 +1912,9 @@ PendingTransaction *WalletImpl::createSweepUnmixableTransaction() +@@ -1690,6 +1841,9 @@ PendingTransaction *WalletImpl::createSweepUnmixableTransaction() PendingTransactionImpl * transaction = new PendingTransactionImpl(*this); do { @@ -1050,7 +1051,7 @@ index d96ea97ea..7d430b655 100644 try { transaction->m_pending_tx = m_wallet->create_unmixable_sweep_transactions(); pendingTxPostProcess(transaction); -@@ -1894,11 +2048,15 @@ uint32_t WalletImpl::defaultMixin() const +@@ -1823,11 +1977,15 @@ uint32_t WalletImpl::defaultMixin() const void WalletImpl::setDefaultMixin(uint32_t arg) { @@ -1066,7 +1067,7 @@ index d96ea97ea..7d430b655 100644 m_wallet->set_attribute(key, val); return true; } -@@ -1912,6 +2070,8 @@ std::string WalletImpl::getCacheAttribute(const std::string &key) const +@@ -1841,6 +1999,8 @@ std::string WalletImpl::getCacheAttribute(const std::string &key) const bool WalletImpl::setUserNote(const std::string &txid, const std::string ¬e) { @@ -1075,7 +1076,7 @@ index d96ea97ea..7d430b655 100644 cryptonote::blobdata txid_data; if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data) || txid_data.size() != sizeof(crypto::hash)) return false; -@@ -1923,6 +2083,8 @@ bool WalletImpl::setUserNote(const std::string &txid, const std::string ¬e) +@@ -1852,6 +2012,8 @@ bool WalletImpl::setUserNote(const std::string &txid, const std::string ¬e) std::string WalletImpl::getUserNote(const std::string &txid) const { @@ -1084,7 +1085,7 @@ index d96ea97ea..7d430b655 100644 cryptonote::blobdata txid_data; if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data) || txid_data.size() != sizeof(crypto::hash)) return ""; -@@ -1933,6 +2095,9 @@ std::string WalletImpl::getUserNote(const std::string &txid) const +@@ -1862,6 +2024,9 @@ std::string WalletImpl::getUserNote(const std::string &txid) const std::string WalletImpl::getTxKey(const std::string &txid_str) const { @@ -1094,7 +1095,7 @@ index d96ea97ea..7d430b655 100644 crypto::hash txid; if(!epee::string_tools::hex_to_pod(txid_str, txid)) { -@@ -2017,6 +2182,9 @@ bool WalletImpl::checkTxKey(const std::string &txid_str, std::string tx_key_str, +@@ -1946,6 +2111,9 @@ bool WalletImpl::checkTxKey(const std::string &txid_str, std::string tx_key_str, std::string WalletImpl::getTxProof(const std::string &txid_str, const std::string &address_str, const std::string &message) const { @@ -1104,7 +1105,7 @@ index d96ea97ea..7d430b655 100644 crypto::hash txid; if (!epee::string_tools::hex_to_pod(txid_str, txid)) { -@@ -2073,6 +2241,9 @@ bool WalletImpl::checkTxProof(const std::string &txid_str, const std::string &ad +@@ -2002,6 +2170,9 @@ bool WalletImpl::checkTxProof(const std::string &txid_str, const std::string &ad } std::string WalletImpl::getSpendProof(const std::string &txid_str, const std::string &message) const { @@ -1114,7 +1115,7 @@ index d96ea97ea..7d430b655 100644 crypto::hash txid; if(!epee::string_tools::hex_to_pod(txid_str, txid)) { -@@ -2115,6 +2286,9 @@ bool WalletImpl::checkSpendProof(const std::string &txid_str, const std::string +@@ -2044,6 +2215,9 @@ bool WalletImpl::checkSpendProof(const std::string &txid_str, const std::string } std::string WalletImpl::getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const { @@ -1124,7 +1125,7 @@ index d96ea97ea..7d430b655 100644 try { clearStatus(); -@@ -2161,6 +2335,9 @@ bool WalletImpl::checkReserveProof(const std::string &address, const std::string +@@ -2090,6 +2264,9 @@ bool WalletImpl::checkReserveProof(const std::string &address, const std::string std::string WalletImpl::signMessage(const std::string &message, const std::string &address) { @@ -1134,7 +1135,7 @@ index d96ea97ea..7d430b655 100644 if (address.empty()) { return m_wallet->sign(message, tools::wallet2::sign_with_spend_key); } -@@ -2288,6 +2465,16 @@ bool WalletImpl::isDeterministic() const +@@ -2217,6 +2394,16 @@ bool WalletImpl::isDeterministic() const return m_wallet->is_deterministic(); } @@ -1151,7 +1152,7 @@ index d96ea97ea..7d430b655 100644 void WalletImpl::clearStatus() const { boost::lock_guard l(m_statusMutex); -@@ -2356,9 +2543,7 @@ void WalletImpl::doRefresh() +@@ -2285,9 +2472,7 @@ void WalletImpl::doRefresh() if(rescan) m_wallet->rescan_blockchain(false); m_wallet->refresh(trustedDaemon()); @@ -1162,7 +1163,7 @@ index d96ea97ea..7d430b655 100644 // assuming if we have empty history, it wasn't initialized yet // for further history changes client need to update history in // "on_money_received" and "on_money_sent" callbacks -@@ -2462,6 +2647,24 @@ bool WalletImpl::doInit(const string &daemon_address, const std::string &proxy_a +@@ -2391,6 +2576,24 @@ bool WalletImpl::doInit(const string &daemon_address, const std::string &proxy_a return true; } @@ -1187,7 +1188,7 @@ index d96ea97ea..7d430b655 100644 bool WalletImpl::parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector &unknown_parameters, std::string &error) { return m_wallet->parse_uri(uri, address, payment_id, amount, tx_description, recipient_name, unknown_parameters, error); -@@ -2480,6 +2683,8 @@ std::string WalletImpl::getDefaultDataDir() const +@@ -2409,6 +2612,8 @@ std::string WalletImpl::getDefaultDataDir() const bool WalletImpl::rescanSpent() { clearStatus(); @@ -1197,10 +1198,10 @@ index d96ea97ea..7d430b655 100644 setStatusError(tr("Rescan spent can only be used with a trusted daemon")); return false; diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index 787215ab3..9acd2871f 100644 +index ec2d7e9b3..1f199a72c 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h -@@ -181,6 +181,13 @@ public: +@@ -171,6 +171,13 @@ public: bool importOutputs(const std::string &filename) override; bool scanTransactions(const std::vector &txids) override; @@ -1214,7 +1215,7 @@ index 787215ab3..9acd2871f 100644 virtual void disposeTransaction(PendingTransaction * t) override; virtual uint64_t estimateTransactionFee(const std::vector> &destinations, PendingTransaction::Priority priority) const override; -@@ -249,6 +256,7 @@ private: +@@ -239,6 +246,7 @@ private: bool isNewWallet() const; void pendingTxPostProcess(PendingTransactionImpl * pending); bool doInit(const std::string &daemon_address, const std::string &proxy_address, uint64_t upper_transaction_size_limit = 0, bool ssl = false); @@ -1222,7 +1223,7 @@ index 787215ab3..9acd2871f 100644 private: friend class PendingTransactionImpl; -@@ -263,6 +271,10 @@ private: +@@ -253,6 +261,10 @@ private: mutable boost::mutex m_statusMutex; mutable int m_status; mutable std::string m_errorString; @@ -1234,7 +1235,7 @@ index 787215ab3..9acd2871f 100644 std::unique_ptr m_history; std::unique_ptr m_wallet2Callback; diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index 9ea753083..4268b656e 100644 +index 71991df0d..e349df176 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -445,6 +445,12 @@ struct Wallet @@ -1250,7 +1251,7 @@ index 9ea753083..4268b656e 100644 virtual ~Wallet() = 0; virtual std::string seed(const std::string& seed_offset = "") const = 0; virtual std::string getSeedLanguage() const = 0; -@@ -940,6 +946,42 @@ struct Wallet +@@ -936,6 +942,42 @@ struct Wallet */ virtual bool scanTransactions(const std::vector &txids) = 0; @@ -1294,10 +1295,10 @@ 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 9e95f44d6..f2381740a 100644 +index ad8c36190..8146014d6 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp -@@ -158,6 +158,8 @@ static const std::string MULTISIG_SIGNATURE_MAGIC = "SigMultisigPkV1"; +@@ -157,6 +157,8 @@ static const std::string MULTISIG_SIGNATURE_MAGIC = "SigMultisigPkV1"; static const std::string ASCII_OUTPUT_MAGIC = "MoneroAsciiDataV1"; @@ -1306,7 +1307,7 @@ index 9e95f44d6..f2381740a 100644 boost::mutex tools::wallet2::default_daemon_address_lock; std::string tools::wallet2::default_daemon_address = ""; -@@ -1010,14 +1012,14 @@ uint64_t num_priv_multisig_keys_post_setup(uint64_t threshold, uint64_t total) +@@ -1009,14 +1011,14 @@ uint64_t num_priv_multisig_keys_post_setup(uint64_t threshold, uint64_t total) * @param keys_data_key the chacha key that encrypts wallet keys files * @return crypto::chacha_key the chacha key that encrypts the wallet cache files */ @@ -1323,7 +1324,7 @@ index 9e95f44d6..f2381740a 100644 cn_fast_hash(cache_key_data.data(), HASH_SIZE+1, (crypto::hash&) cache_key); return cache_key; -@@ -1105,7 +1107,7 @@ wallet_keys_unlocker::wallet_keys_unlocker(wallet2 &w, const boost::optional lock(lockers_lock); if (lockers++ > 0) locked = false; @@ -1332,7 +1333,7 @@ index 9e95f44d6..f2381740a 100644 { locked = false; return; -@@ -1222,6 +1224,11 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std +@@ -1221,6 +1223,11 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std m_ignore_outputs_above(MONEY_SUPPLY), m_ignore_outputs_below(0), m_track_uses(false), @@ -1344,7 +1345,7 @@ index 9e95f44d6..f2381740a 100644 m_show_wallet_name_when_locked(false), m_inactivity_lock_timeout(DEFAULT_INACTIVITY_LOCK_TIMEOUT), m_setup_background_mining(BackgroundMiningMaybe), -@@ -1877,6 +1884,9 @@ bool has_nonrequested_tx_at_height_or_above_requested(uint64_t height, const std +@@ -1860,6 +1867,9 @@ bool has_nonrequested_tx_at_height_or_above_requested(uint64_t height, const std //---------------------------------------------------------------------------------------------------- void wallet2::scan_tx(const std::unordered_set &txids) { @@ -1354,7 +1355,7 @@ index 9e95f44d6..f2381740a 100644 // Get the transactions from daemon in batches sorted lowest height to highest tx_entry_data txs_to_scan = get_tx_entries(txids); if (txs_to_scan.tx_entries.empty()) -@@ -2184,11 +2194,11 @@ void wallet2::scan_output(const cryptonote::transaction &tx, bool miner_tx, cons +@@ -2167,11 +2177,11 @@ void wallet2::scan_output(const cryptonote::transaction &tx, bool miner_tx, cons THROW_WALLET_EXCEPTION_IF(i >= tx.vout.size(), error::wallet_internal_error, "Invalid vout index"); // if keys are encrypted, ask for password @@ -1368,7 +1369,7 @@ index 9e95f44d6..f2381740a 100644 { boost::optional pwd = m_callback->on_get_password(pool ? "output found in pool" : "output received"); THROW_WALLET_EXCEPTION_IF(!pwd, error::password_needed, tr("Password is needed to compute key image for incoming monero")); -@@ -2200,7 +2210,7 @@ void wallet2::scan_output(const cryptonote::transaction &tx, bool miner_tx, cons +@@ -2183,7 +2193,7 @@ void wallet2::scan_output(const cryptonote::transaction &tx, bool miner_tx, cons crypto::public_key output_public_key; THROW_WALLET_EXCEPTION_IF(!get_output_public_key(tx.vout[i], output_public_key), error::wallet_internal_error, "Failed to get output public key"); @@ -1377,7 +1378,7 @@ index 9e95f44d6..f2381740a 100644 { tx_scan_info.in_ephemeral.pub = output_public_key; tx_scan_info.in_ephemeral.sec = crypto::null_skey; -@@ -2457,6 +2467,22 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote +@@ -2440,6 +2450,22 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote THROW_WALLET_EXCEPTION_IF(tx.vout.size() != o_indices.size(), error::wallet_internal_error, "transactions outputs size=" + std::to_string(tx.vout.size()) + " not match with daemon response size=" + std::to_string(o_indices.size())); @@ -1400,7 +1401,7 @@ index 9e95f44d6..f2381740a 100644 } for(size_t o: outs) -@@ -2482,7 +2508,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote +@@ -2465,7 +2491,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote td.m_tx = (const cryptonote::transaction_prefix&)tx; td.m_txid = txid; td.m_key_image = tx_scan_info[o].ki; @@ -1409,7 +1410,7 @@ index 9e95f44d6..f2381740a 100644 if (!td.m_key_image_known) { // we might have cold signed, and have a mapping to key images -@@ -2672,10 +2698,25 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote +@@ -2655,10 +2681,25 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote set_spent(it->second, height); if (!ignore_callbacks && 0 != m_callback) m_callback->on_money_spent(height, txid, tx, amount, tx, td.m_subaddr_index); @@ -1436,7 +1437,7 @@ index 9e95f44d6..f2381740a 100644 { PERF_TIMER(track_uses); const uint64_t amount = in_to_key.amount; -@@ -2689,7 +2730,27 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote +@@ -2672,7 +2713,27 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote { size_t idx = i->second; THROW_WALLET_EXCEPTION_IF(idx >= m_transfers.size(), error::wallet_internal_error, "Output tracker cache index out of range"); @@ -1465,7 +1466,7 @@ index 9e95f44d6..f2381740a 100644 } } } -@@ -2699,7 +2760,24 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote +@@ -2682,7 +2743,24 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote continue; for (uint64_t offset: offsets) if (offset == td.m_global_output_index) @@ -1491,7 +1492,7 @@ index 9e95f44d6..f2381740a 100644 } } } -@@ -3072,8 +3150,8 @@ void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_heigh +@@ -3055,8 +3133,8 @@ void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_heigh req.start_height = start_height; req.no_miner_tx = m_refresh_type == RefreshNoCoinbase; @@ -1502,7 +1503,7 @@ index 9e95f44d6..f2381740a 100644 req.pool_info_since = m_pool_info_query_time; { -@@ -3100,7 +3178,7 @@ void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_heigh +@@ -3083,7 +3161,7 @@ void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_heigh << ", height " << blocks_start_height + blocks.size() << ", node height " << res.current_height << ", pool info " << static_cast(res.pool_info_extent)); @@ -1511,7 +1512,7 @@ index 9e95f44d6..f2381740a 100644 { if (res.pool_info_extent != COMMAND_RPC_GET_BLOCKS_FAST::NONE) { -@@ -3612,6 +3690,9 @@ void wallet2::process_unconfirmed_transfer(bool incremental, const crypto::hash +@@ -3595,6 +3673,9 @@ void wallet2::process_unconfirmed_transfer(bool incremental, const crypto::hash // incremental update anymore, because with that we might miss some txs altogether. void wallet2::update_pool_state(std::vector> &process_txs, bool refreshed, bool try_incremental) { @@ -1521,7 +1522,7 @@ index 9e95f44d6..f2381740a 100644 bool updated = false; if (m_pool_info_query_time != 0 && try_incremental) { -@@ -4183,6 +4264,8 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo +@@ -4166,6 +4247,8 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo } m_first_refresh_done = true; @@ -1530,7 +1531,7 @@ index 9e95f44d6..f2381740a 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))); } -@@ -4268,6 +4351,14 @@ wallet2::detached_blockchain_data wallet2::detach_blockchain(uint64_t height, st +@@ -4251,6 +4334,14 @@ wallet2::detached_blockchain_data wallet2::detach_blockchain(uint64_t height, st td.m_uses.pop_back(); } @@ -1545,7 +1546,7 @@ index 9e95f44d6..f2381740a 100644 if (output_tracker_cache) output_tracker_cache->clear(); -@@ -4342,8 +4433,12 @@ void wallet2::handle_reorg(uint64_t height, std::map m_blockchain.offset(), error::wallet_internal_error, "Daemon claims reorg below last checkpoint"); @@ -1558,7 +1559,7 @@ index 9e95f44d6..f2381740a 100644 if (m_callback) m_callback->on_reorg(height, dbd.detached_blockchain.size(), dbd.detached_tx_hashes.size()); } -@@ -4353,6 +4448,7 @@ bool wallet2::deinit() +@@ -4336,6 +4431,7 @@ bool wallet2::deinit() if(m_is_initialized) { m_is_initialized = false; unlock_keys_file(); @@ -1566,7 +1567,7 @@ index 9e95f44d6..f2381740a 100644 m_account.deinit(); } return true; -@@ -4379,6 +4475,7 @@ bool wallet2::clear() +@@ -4362,6 +4458,7 @@ bool wallet2::clear() m_device_last_key_image_sync = 0; m_pool_info_query_time = 0; m_skip_to_height = 0; @@ -1574,7 +1575,7 @@ index 9e95f44d6..f2381740a 100644 return true; } //---------------------------------------------------------------------------------------------------- -@@ -4397,13 +4494,30 @@ void wallet2::clear_soft(bool keep_key_images) +@@ -4380,13 +4477,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; @@ -1606,7 +1607,7 @@ index 9e95f44d6..f2381740a 100644 /*! * \brief Stores wallet information to wallet file. * \param keys_file_name Name of wallet file -@@ -4415,16 +4529,35 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable +@@ -4398,16 +4512,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"); @@ -1646,7 +1647,7 @@ index 9e95f44d6..f2381740a 100644 if (e) { boost::filesystem::remove(tmp_file_name); -@@ -4436,26 +4569,27 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable +@@ -4419,26 +4552,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) @@ -1682,7 +1683,7 @@ index 9e95f44d6..f2381740a 100644 account.forget_spend_key(); account.encrypt_keys(key); -@@ -4590,6 +4724,9 @@ boost::optional wallet2::get_keys_file_data(const epee: +@@ -4573,6 +4707,9 @@ boost::optional wallet2::get_keys_file_data(const epee: value2.SetInt(m_track_uses ? 1 : 0); json.AddMember("track_uses", value2, json.GetAllocator()); @@ -1692,19 +1693,20 @@ index 9e95f44d6..f2381740a 100644 value2.SetInt(m_show_wallet_name_when_locked ? 1 : 0); json.AddMember("show_wallet_name_when_locked", value2, json.GetAllocator()); -@@ -4649,6 +4786,11 @@ boost::optional wallet2::get_keys_file_data(const epee: +@@ -4630,6 +4767,12 @@ boost::optional wallet2::get_keys_file_data(const epee: + value2.SetInt(m_enable_multisig ? 1 : 0); + json.AddMember("enable_multisig", value2, json.GetAllocator()); - value2.SetInt(m_polyseed ? 1 : 0); - json.AddMember("polyseed", value2, json.GetAllocator()); + if (m_background_sync_type == BackgroundSyncCustomPassword && !background_keys_file && m_custom_background_key) + { + value.SetString(reinterpret_cast(m_custom_background_key.get().data()), m_custom_background_key.get().size()); + json.AddMember("custom_background_key", value, json.GetAllocator()); + } - ++ // Serialize the JSON object rapidjson::StringBuffer buffer; -@@ -4676,13 +4818,81 @@ void wallet2::setup_keys(const epee::wipeable_string &password) + rapidjson::Writer writer(buffer); +@@ -4656,13 +4799,81 @@ void wallet2::setup_keys(const epee::wipeable_string &password) m_account.decrypt_viewkey(key); } @@ -1787,7 +1789,7 @@ index 9e95f44d6..f2381740a 100644 if (m_ask_password == AskPasswordToDecrypt && !m_unattended && !m_watch_only) decrypt_keys(original_password); setup_keys(new_password); -@@ -4741,8 +4951,24 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -4721,8 +4932,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]); @@ -1813,7 +1815,7 @@ index 9e95f44d6..f2381740a 100644 // The contents should be JSON if the wallet follows the new format. if (json.Parse(account_data.c_str()).HasParseError()) { -@@ -4780,6 +5006,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -4760,6 +4987,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; @@ -1821,18 +1823,18 @@ index 9e95f44d6..f2381740a 100644 m_show_wallet_name_when_locked = false; m_inactivity_lock_timeout = DEFAULT_INACTIVITY_LOCK_TIMEOUT; m_setup_background_mining = BackgroundMiningMaybe; -@@ -4798,6 +5025,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -4777,6 +5005,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; - m_polyseed = false; + m_custom_background_key = boost::none; } else if(json.IsObject()) { -@@ -5036,6 +5264,39 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -5013,6 +5242,39 @@ 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; - GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, polyseed, int, Int, false, false); - m_polyseed = field_polyseed; + + GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, background_sync_type, BackgroundSyncType, Int, false, BackgroundSyncOff); + m_background_sync_type = field_background_sync_type; @@ -1869,7 +1871,7 @@ index 9e95f44d6..f2381740a 100644 } else { -@@ -5099,12 +5360,17 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -5076,12 +5338,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); @@ -1889,7 +1891,7 @@ index 9e95f44d6..f2381740a 100644 return true; } -@@ -5119,11 +5385,12 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st +@@ -5096,11 +5363,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 * */ @@ -1904,7 +1906,7 @@ index 9e95f44d6..f2381740a 100644 lock_keys_file(); return r; } -@@ -5141,7 +5408,7 @@ bool wallet2::verify_password(const epee::wipeable_string& password) +@@ -5118,7 +5386,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 * */ @@ -1913,7 +1915,7 @@ index 9e95f44d6..f2381740a 100644 { rapidjson::Document json; wallet2::keys_file_data keys_file_data; -@@ -5158,9 +5425,22 @@ bool wallet2::verify_password(const std::string& keys_file_name, const epee::wip +@@ -5135,9 +5403,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]); @@ -1937,7 +1939,7 @@ index 9e95f44d6..f2381740a 100644 // The contents should be JSON if the wallet follows the new format. if (json.Parse(account_data.c_str()).HasParseError()) { -@@ -5185,6 +5465,7 @@ bool wallet2::verify_password(const std::string& keys_file_name, const epee::wip +@@ -5162,6 +5443,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); @@ -1945,7 +1947,7 @@ index 9e95f44d6..f2381740a 100644 return r; } -@@ -5196,9 +5477,7 @@ void wallet2::encrypt_keys(const crypto::chacha_key &key) +@@ -5173,9 +5455,7 @@ void wallet2::encrypt_keys(const crypto::chacha_key &key) void wallet2::decrypt_keys(const crypto::chacha_key &key) { @@ -1956,7 +1958,7 @@ index 9e95f44d6..f2381740a 100644 m_account.encrypt_viewkey(key); m_account.decrypt_keys(key); -@@ -5916,11 +6195,30 @@ void wallet2::rewrite(const std::string& wallet_name, const epee::wipeable_strin +@@ -5851,11 +6131,30 @@ void wallet2::rewrite(const std::string& wallet_name, const epee::wipeable_strin { if (wallet_name.empty()) return; @@ -1987,7 +1989,7 @@ index 9e95f44d6..f2381740a 100644 } /*! * \brief Writes to a file named based on the normal wallet (doesn't generate key, assumes it's already there) -@@ -5954,6 +6252,16 @@ bool wallet2::wallet_valid_path_format(const std::string& file_path) +@@ -5889,6 +6188,16 @@ bool wallet2::wallet_valid_path_format(const std::string& file_path) return !file_path.empty(); } //---------------------------------------------------------------------------------------------------- @@ -2004,7 +2006,7 @@ index 9e95f44d6..f2381740a 100644 bool wallet2::parse_long_payment_id(const std::string& payment_id_str, crypto::hash& payment_id) { cryptonote::blobdata payment_id_data; -@@ -6189,10 +6497,81 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass +@@ -6124,10 +6433,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"); } @@ -2087,7 +2089,7 @@ index 9e95f44d6..f2381740a 100644 bool cache_missing = use_fs ? (!boost::filesystem::exists(m_wallet_file, e) || e) : cache_buf.empty(); if (cache_missing) { -@@ -6206,7 +6585,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass +@@ -6141,7 +6521,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass bool r = true; if (use_fs) { @@ -2096,7 +2098,7 @@ index 9e95f44d6..f2381740a 100644 THROW_WALLET_EXCEPTION_IF(!r, error::file_read_error, m_wallet_file); } -@@ -6219,7 +6598,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass +@@ -6154,7 +6534,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()); @@ -2105,7 +2107,7 @@ index 9e95f44d6..f2381740a 100644 try { bool loaded = false; -@@ -6309,60 +6688,76 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass +@@ -6244,60 +6624,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); } @@ -2224,7 +2226,7 @@ index 9e95f44d6..f2381740a 100644 } } //---------------------------------------------------------------------------------------------------- -@@ -6444,6 +6839,8 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas +@@ -6379,6 +6775,8 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas same_file = canonical_old_path == canonical_new_path; } @@ -2233,7 +2235,7 @@ index 9e95f44d6..f2381740a 100644 if (!same_file) { -@@ -6460,6 +6857,21 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas +@@ -6395,6 +6793,21 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas } } } @@ -2255,7 +2257,7 @@ index 9e95f44d6..f2381740a 100644 // get wallet cache data boost::optional cache_file_data = get_cache_file_data(); -@@ -6553,6 +6965,22 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas +@@ -6488,6 +6901,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); } @@ -2278,7 +2280,7 @@ index 9e95f44d6..f2381740a 100644 } //---------------------------------------------------------------------------------------------------- boost::optional wallet2::get_cache_file_data() -@@ -6570,7 +6998,7 @@ boost::optional wallet2::get_cache_file_data() +@@ -6505,7 +6934,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(); @@ -2287,7 +2289,7 @@ index 9e95f44d6..f2381740a 100644 cache_file_data.get().cache_data = cipher; return cache_file_data; } -@@ -8646,6 +9074,34 @@ bool wallet2::is_keys_file_locked() const +@@ -8581,6 +9010,34 @@ bool wallet2::is_keys_file_locked() const return m_keys_file_locker->locked(); } @@ -2322,7 +2324,7 @@ index 9e95f44d6..f2381740a 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 -@@ -13978,6 +14434,413 @@ bool wallet2::import_key_images(signed_tx_set & signed_tx, size_t offset, bool o +@@ -13913,6 +14370,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); } @@ -2737,10 +2739,10 @@ index 9e95f44d6..f2381740a 100644 { payment_container payments; diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index 91ec72e0f..56cc118f4 100644 +index 24366f630..b1dc4f716 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h -@@ -257,6 +257,20 @@ private: +@@ -256,6 +256,20 @@ private: BackgroundMiningNo = 2, }; @@ -2761,7 +2763,7 @@ index 91ec72e0f..56cc118f4 100644 enum ExportFormat { Binary = 0, Ascii, -@@ -283,7 +297,12 @@ private: +@@ -282,7 +296,12 @@ private: //! Just parses variables. static std::unique_ptr make_dummy(const boost::program_options::variables_map& vm, bool unattended, const std::function(const char *, bool)> &password_prompter); @@ -2775,7 +2777,7 @@ index 91ec72e0f..56cc118f4 100644 static bool query_device(hw::device::device_type& device_type, const std::string& keys_file_name, const epee::wipeable_string& password, uint64_t kdf_rounds = 1); wallet2(cryptonote::network_type nettype = cryptonote::MAINNET, uint64_t kdf_rounds = 1, bool unattended = false, std::unique_ptr http_client_factory = std::unique_ptr(new net::http::client_factory())); -@@ -793,6 +812,54 @@ private: +@@ -792,6 +811,54 @@ private: END_SERIALIZE() }; @@ -2830,7 +2832,7 @@ index 91ec72e0f..56cc118f4 100644 typedef std::tuple get_outs_entry; struct parsed_block -@@ -989,7 +1056,8 @@ private: +@@ -974,7 +1041,8 @@ private: /*! * \brief verifies given password is correct for default wallet keys file */ @@ -2840,7 +2842,7 @@ index 91ec72e0f..56cc118f4 100644 cryptonote::account_base& get_account(){return m_account;} const cryptonote::account_base& get_account()const{return m_account;} -@@ -1093,6 +1161,7 @@ private: +@@ -1069,6 +1137,7 @@ private: cryptonote::network_type nettype() const { return m_nettype; } bool watch_only() const { return m_watch_only; } bool multisig(bool *ready = NULL, uint32_t *threshold = NULL, uint32_t *total = NULL) const; @@ -2848,7 +2850,7 @@ index 91ec72e0f..56cc118f4 100644 bool has_multisig_partial_key_images() const; bool has_unknown_key_images() const; bool get_multisig_seed(epee::wipeable_string& seed, const epee::wipeable_string &passphrase = std::string()) const; -@@ -1300,11 +1369,17 @@ private: +@@ -1276,11 +1345,17 @@ private: return; } a & m_has_ever_refreshed_from_node; @@ -2867,7 +2869,7 @@ index 91ec72e0f..56cc118f4 100644 FIELD(m_blockchain) FIELD(m_transfers) FIELD(m_account_public_address) -@@ -1336,6 +1411,12 @@ private: +@@ -1312,6 +1387,12 @@ private: return true; } FIELD(m_has_ever_refreshed_from_node) @@ -2880,7 +2882,7 @@ index 91ec72e0f..56cc118f4 100644 END_SERIALIZE() /*! -@@ -1351,6 +1432,8 @@ private: +@@ -1327,6 +1408,8 @@ private: * \return Whether path is valid format */ static bool wallet_valid_path_format(const std::string& file_path); @@ -2889,7 +2891,7 @@ index 91ec72e0f..56cc118f4 100644 static bool parse_long_payment_id(const std::string& payment_id_str, crypto::hash& payment_id); static bool parse_short_payment_id(const std::string& payment_id_str, crypto::hash8& payment_id); static bool parse_payment_id(const std::string& payment_id_str, crypto::hash& payment_id); -@@ -1399,6 +1482,9 @@ private: +@@ -1375,6 +1458,9 @@ private: void ignore_outputs_below(uint64_t value) { m_ignore_outputs_below = value; } bool track_uses() const { return m_track_uses; } void track_uses(bool value) { m_track_uses = value; } @@ -2899,7 +2901,7 @@ index 91ec72e0f..56cc118f4 100644 bool show_wallet_name_when_locked() const { return m_show_wallet_name_when_locked; } void show_wallet_name_when_locked(bool value) { m_show_wallet_name_when_locked = value; } BackgroundMiningSetupType setup_background_mining() const { return m_setup_background_mining; } -@@ -1714,6 +1800,9 @@ private: +@@ -1689,6 +1775,9 @@ private: uint64_t get_bytes_sent() const; uint64_t get_bytes_received() const; @@ -2909,7 +2911,7 @@ index 91ec72e0f..56cc118f4 100644 // MMS ------------------------------------------------------------------------------------------------- mms::message_store& get_message_store() { return m_message_store; }; const mms::message_store& get_message_store() const { return m_message_store; }; -@@ -1749,6 +1838,9 @@ private: +@@ -1724,6 +1813,9 @@ private: * \return Whether it was successful. */ bool store_keys(const std::string& keys_file_name, const epee::wipeable_string& password, bool watch_only = false); @@ -2919,7 +2921,7 @@ index 91ec72e0f..56cc118f4 100644 /*! * \brief Load wallet keys information from wallet file. * \param keys_file_name Name of wallet file -@@ -1762,6 +1854,7 @@ private: +@@ -1737,6 +1829,7 @@ private: */ bool load_keys_buf(const std::string& keys_buf, const epee::wipeable_string& password); bool load_keys_buf(const std::string& keys_buf, const epee::wipeable_string& password, boost::optional& keys_to_encrypt); @@ -2927,7 +2929,7 @@ index 91ec72e0f..56cc118f4 100644 void process_new_transaction(const crypto::hash &txid, const cryptonote::transaction& tx, const std::vector &o_indices, uint64_t height, uint8_t block_version, uint64_t ts, bool miner_tx, bool pool, bool double_spend_seen, const tx_cache_data &tx_cache_data, std::map, size_t> *output_tracker_cache = NULL, bool ignore_callbacks = false); bool should_skip_block(const cryptonote::block &b, uint64_t height) const; void process_new_blockchain_entry(const cryptonote::block& b, const cryptonote::block_complete_entry& bche, const parsed_block &parsed_block, const crypto::hash& bl_id, uint64_t height, const std::vector &tx_cache_data, size_t tx_cache_data_offset, std::map, size_t> *output_tracker_cache = NULL); -@@ -1770,6 +1863,15 @@ private: +@@ -1745,6 +1838,15 @@ private: void get_short_chain_history(std::list& ids, uint64_t granularity = 1) const; bool clear(); void clear_soft(bool keep_key_images=false); @@ -2943,7 +2945,7 @@ index 91ec72e0f..56cc118f4 100644 void pull_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t& blocks_start_height, const std::list &short_chain_history, std::vector &blocks, std::vector &o_indices, uint64_t ¤t_height); void pull_hashes(uint64_t start_height, uint64_t& blocks_start_height, const std::list &short_chain_history, std::vector &hashes); void fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list &short_chain_history, bool force = false); -@@ -1821,10 +1923,23 @@ private: +@@ -1796,10 +1898,23 @@ private: bool get_ring(const crypto::chacha_key &key, const crypto::key_image &key_image, std::vector &outs); crypto::chacha_key get_ringdb_key(); void setup_keys(const epee::wipeable_string &password); @@ -2967,7 +2969,7 @@ index 91ec72e0f..56cc118f4 100644 void register_devices(); hw::device& lookup_device(const std::string & device_descriptor); -@@ -1940,6 +2055,8 @@ private: +@@ -1914,6 +2029,8 @@ private: uint64_t m_ignore_outputs_above; uint64_t m_ignore_outputs_below; bool m_track_uses; @@ -2976,7 +2978,7 @@ index 91ec72e0f..56cc118f4 100644 bool m_show_wallet_name_when_locked; uint32_t m_inactivity_lock_timeout; BackgroundMiningSetupType m_setup_background_mining; -@@ -1985,6 +2102,7 @@ private: +@@ -1959,6 +2076,7 @@ private: uint64_t m_last_block_reward; std::unique_ptr m_keys_file_locker; @@ -2984,7 +2986,7 @@ index 91ec72e0f..56cc118f4 100644 mms::message_store m_message_store; bool m_original_keys_available; -@@ -1992,6 +2110,7 @@ private: +@@ -1966,6 +2084,7 @@ private: crypto::secret_key m_original_view_secret_key; crypto::chacha_key m_cache_key; @@ -2992,7 +2994,7 @@ index 91ec72e0f..56cc118f4 100644 std::shared_ptr m_encrypt_keys_after_refresh; bool m_unattended; -@@ -2007,9 +2126,13 @@ private: +@@ -1981,9 +2100,13 @@ private: static boost::mutex default_daemon_address_lock; static std::string default_daemon_address; @@ -3007,7 +3009,7 @@ index 91ec72e0f..56cc118f4 100644 BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 12) BOOST_CLASS_VERSION(tools::wallet2::multisig_info, 1) BOOST_CLASS_VERSION(tools::wallet2::multisig_info::LR, 0) -@@ -2025,6 +2148,8 @@ BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1) +@@ -1999,6 +2122,8 @@ BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1) BOOST_CLASS_VERSION(tools::wallet2::tx_construction_data, 4) BOOST_CLASS_VERSION(tools::wallet2::pending_tx, 3) BOOST_CLASS_VERSION(tools::wallet2::multisig_sig, 1) @@ -3016,7 +3018,7 @@ index 91ec72e0f..56cc118f4 100644 namespace boost { -@@ -2523,6 +2648,29 @@ namespace boost +@@ -2497,6 +2622,29 @@ namespace boost return; a & x.multisig_sigs; } @@ -3662,7 +3664,7 @@ 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 541d29f86..6e88f6967 100644 +index 541d29f86..4756c191c 100644 --- a/src/wallet/wallet_rpc_server_error_codes.h +++ b/src/wallet/wallet_rpc_server_error_codes.h @@ -81,3 +81,5 @@ @@ -3671,7 +3673,6 @@ index 541d29f86..6e88f6967 100644 #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 @@ -4312,5 +4313,5 @@ index 1e10e1f86..bff33a561 100644 + } + return self.rpc.send_json_rpc_request(stop_background_sync) -- -2.39.2 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0011-store-crash-fix.patch b/patches/monero/0002-store-crash-fix.patch similarity index 87% rename from patches/monero/0011-store-crash-fix.patch rename to patches/monero/0002-store-crash-fix.patch index 1ddae67d..89c353ca 100644 --- a/patches/monero/0011-store-crash-fix.patch +++ b/patches/monero/0002-store-crash-fix.patch @@ -1,7 +1,7 @@ -From 238c847c153c74953b094d83bfe181a596771d37 Mon Sep 17 00:00:00 2001 +From a671dfe3e4d4723942f87a57a70a1a42f778cb4c Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Sat, 11 May 2024 16:25:10 +0200 -Subject: [PATCH 11/16] store crash fix +Subject: [PATCH 02/11] store crash fix Monero wallet crashes (sometimes) when it is syncing, while the proper solution (that can be seen in feather) @@ -43,10 +43,10 @@ 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 ec4ae51ff..306c9b8ae 100644 +index e9f76f4cf..0d85cf359 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp -@@ -56,8 +56,8 @@ using namespace cryptonote; +@@ -55,8 +55,8 @@ using namespace cryptonote; #define MONERO_DEFAULT_LOG_CATEGORY "WalletAPI" #define LOCK_REFRESH() \ @@ -57,7 +57,7 @@ index ec4ae51ff..306c9b8ae 100644 m_wallet->stop(); \ m_refreshCV.notify_one(); \ boost::mutex::scoped_lock lock(m_refreshMutex); \ -@@ -467,7 +467,7 @@ WalletImpl::WalletImpl(NetworkType nettype, uint64_t kdf_rounds) +@@ -466,7 +466,7 @@ WalletImpl::WalletImpl(NetworkType nettype, uint64_t kdf_rounds) m_wallet2Callback.reset(new Wallet2CallbackImpl(this)); m_wallet->callback(m_wallet2Callback.get()); m_refreshThreadDone = false; @@ -65,8 +65,8 @@ index ec4ae51ff..306c9b8ae 100644 + m_wallet->set_refresh_enabled(false); m_addressBook.reset(new AddressBookImpl(this)); m_subaddress.reset(new SubaddressImpl(this)); - m_coins.reset(new CoinsImpl(this)); -@@ -1064,6 +1064,7 @@ void WalletImpl::stop() + m_subaddressAccount.reset(new SubaddressAccountImpl(this)); +@@ -962,6 +962,7 @@ void WalletImpl::stop() bool WalletImpl::store(const std::string &path) { clearStatus(); @@ -74,7 +74,7 @@ index ec4ae51ff..306c9b8ae 100644 try { if (path.empty()) { m_wallet->store(); -@@ -2591,10 +2592,10 @@ void WalletImpl::refreshThreadFunc() +@@ -2448,10 +2449,10 @@ void WalletImpl::refreshThreadFunc() } LOG_PRINT_L3(__FUNCTION__ << ": refresh lock acquired..."); @@ -87,7 +87,7 @@ index ec4ae51ff..306c9b8ae 100644 LOG_PRINT_L3(__FUNCTION__ << ": refreshing..."); doRefresh(); } -@@ -2624,12 +2625,12 @@ void WalletImpl::doRefresh() +@@ -2481,12 +2482,12 @@ void WalletImpl::doRefresh() } m_wallet->find_and_save_rings(false); } else { @@ -102,7 +102,7 @@ index ec4ae51ff..306c9b8ae 100644 if (m_wallet2Callback->getListener()) { m_wallet2Callback->getListener()->refreshed(); -@@ -2639,9 +2640,9 @@ void WalletImpl::doRefresh() +@@ -2496,9 +2497,9 @@ void WalletImpl::doRefresh() void WalletImpl::startRefresh() { @@ -114,7 +114,7 @@ index ec4ae51ff..306c9b8ae 100644 m_refreshCV.notify_one(); } } -@@ -2651,7 +2652,7 @@ void WalletImpl::startRefresh() +@@ -2508,7 +2509,7 @@ void WalletImpl::startRefresh() void WalletImpl::stopRefresh() { if (!m_refreshThreadDone) { @@ -123,7 +123,7 @@ index ec4ae51ff..306c9b8ae 100644 m_refreshThreadDone = true; m_refreshCV.notify_one(); m_refreshThread.join(); -@@ -2662,9 +2663,7 @@ void WalletImpl::pauseRefresh() +@@ -2519,9 +2520,7 @@ void WalletImpl::pauseRefresh() { LOG_PRINT_L2(__FUNCTION__ << ": refresh paused..."); // TODO synchronize access @@ -135,10 +135,10 @@ index ec4ae51ff..306c9b8ae 100644 diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index d0f443abc..2ad2b62a4 100644 +index 1f199a72c..ac7ce2f6a 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h -@@ -295,7 +295,6 @@ private: +@@ -273,7 +273,6 @@ private: std::unique_ptr m_subaddressAccount; // multi-threaded refresh stuff @@ -147,10 +147,10 @@ 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 61601f70c..4de226a4a 100644 +index 8146014d6..aa61fb298 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 +@@ -1192,6 +1192,7 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std m_upper_transaction_weight_limit(0), m_run(true), m_callback(0), @@ -158,7 +158,7 @@ index 61601f70c..4de226a4a 100644 m_trusted_daemon(false), m_nettype(nettype), m_multisig_rounds_passed(0), -@@ -1416,6 +1417,14 @@ bool wallet2::set_daemon(std::string daemon_address, boost::optionalset_proxy(address); -@@ -4146,8 +4155,9 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo +@@ -4096,8 +4105,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,10 +185,10 @@ index 61601f70c..4de226a4a 100644 std::vector next_blocks; std::vector next_parsed_blocks; diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index fdc1a6212..3ce710433 100644 +index b1dc4f716..a050286bc 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h -@@ -1086,6 +1086,8 @@ private: +@@ -1071,6 +1071,8 @@ private: boost::optional daemon_login = boost::none, bool trusted_daemon = true, epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_autodetect); bool set_proxy(const std::string &address); @@ -197,7 +197,7 @@ index fdc1a6212..3ce710433 100644 void stop() { m_run.store(false, std::memory_order_relaxed); m_message_store.stop(); } -@@ -2012,6 +2014,7 @@ private: +@@ -1981,6 +1983,7 @@ private: boost::recursive_mutex m_daemon_rpc_mutex; @@ -206,5 +206,5 @@ index fdc1a6212..3ce710433 100644 i_wallet2_callback* m_callback; hw::device::device_type m_key_device_type; -- -2.39.2 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0013-android-ndk-version-bump.patch b/patches/monero/0003-Update-android-ndk.patch similarity index 64% rename from patches/monero/0013-android-ndk-version-bump.patch rename to patches/monero/0003-Update-android-ndk.patch index 2b741a0a..1f3df97b 100644 --- a/patches/monero/0013-android-ndk-version-bump.patch +++ b/patches/monero/0003-Update-android-ndk.patch @@ -1,25 +1,28 @@ -From 1b978a697e1bdb3144bc08f998d125ac593fa971 Mon Sep 17 00:00:00 2001 +From e2526a2a08b96dd75f8c9effe475dd15156c743e Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Thu, 23 May 2024 08:02:49 +0200 -Subject: [PATCH 13/16] android ndk version bump +Subject: [PATCH 03/11] Update android ndk +rename arm -> armv7a --- - contrib/depends/hosts/android.mk | 16 +++++++++++++--- - contrib/depends/packages/android_ndk.mk | 20 ++++++++++++++------ + contrib/depends/hosts/android.mk | 18 ++++++++++++---- + contrib/depends/packages/android_ndk.mk | 28 ++++++++++++++++++------- contrib/depends/packages/boost.mk | 1 + - contrib/depends/toolchain.cmake.in | 11 ++++++----- - 4 files changed, 34 insertions(+), 14 deletions(-) + contrib/depends/packages/openssl.mk | 2 +- + contrib/depends/toolchain.cmake.in | 13 ++++++------ + 5 files changed, 44 insertions(+), 18 deletions(-) diff --git a/contrib/depends/hosts/android.mk b/contrib/depends/hosts/android.mk -index d6f8b99dd..e1c99aef3 100644 +index d6f8b99dd..827103c36 100644 --- a/contrib/depends/hosts/android.mk +++ b/contrib/depends/hosts/android.mk @@ -1,12 +1,22 @@ ANDROID_API=21 - -+host_toolchain=nonexistent - ifeq ($(host_arch),arm) +-ifeq ($(host_arch),arm) -host_toolchain=arm-linux-androideabi- ++host_toolchain=nonexistent ++ifeq ($(host_arch),armv7a) +host_toolchain=armv7a-linux-androideabi${ANDROID_API}- +endif +ifeq ($(host_arch),x86_64) @@ -41,10 +44,10 @@ index d6f8b99dd..e1c99aef3 100644 android_CFLAGS=-pipe android_CXXFLAGS=$(android_CFLAGS) diff --git a/contrib/depends/packages/android_ndk.mk b/contrib/depends/packages/android_ndk.mk -index 5deff76c7..1ad250653 100644 +index 9b8a5332f..2c2914ec2 100644 --- a/contrib/depends/packages/android_ndk.mk +++ b/contrib/depends/packages/android_ndk.mk -@@ -1,8 +1,10 @@ +@@ -1,12 +1,16 @@ package=android_ndk -$(package)_version=17b +$(package)_version=26d @@ -57,10 +60,20 @@ index 5deff76c7..1ad250653 100644 +$(package)_version_apiversion=21 define $(package)_set_vars - $(package)_config_opts_arm=--arch arm -@@ -17,8 +19,14 @@ define $(package)_extract_cmds +-$(package)_config_opts_arm=--arch arm ++$(package)_config_opts_armv7a=--arch arm + $(package)_config_opts_aarch64=--arch arm64 ++$(package)_config_opts_x86_64=--arch x86_64 ++$(package)_config_opts_i686=--arch x86 endef + define $(package)_extract_cmds +@@ -14,9 +18,19 @@ define $(package)_extract_cmds + unzip -q $($(1)_source_dir)/$($(package)_file_name) + endef + ++# arm-linux-androideabi-ar - openssl workaround ++ define $(package)_stage_cmds - android-ndk-r$($(package)_version)/build/tools/make_standalone_toolchain.py --api 21 \ - --install-dir $(build_prefix) --stl=libc++ $($(package)_config_opts) &&\ @@ -71,7 +84,9 @@ index 5deff76c7..1ad250653 100644 + --install-dir $(build_prefix)/toolchain --stl=libc++ $($(package)_config_opts) &&\ + mv $(build_prefix)/toolchain $($(package)_staging_dir)/$(host_prefix)/native && \ + cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ar $($(package)_staging_dir)/$(host_prefix)/native/bin/$(host)$($(package)_version_apiversion)-ar &&\ ++ cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ar $($(package)_staging_dir)/$(host_prefix)/native/bin/arm-linux-androideabi-ar &&\ + cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ranlib $($(package)_staging_dir)/$(host_prefix)/native/bin/$(host)$($(package)_version_apiversion)-ranlib &&\ ++ cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ranlib $($(package)_staging_dir)/$(host_prefix)/native/bin/arm-linux-androideabi-ranlib &&\ + cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ar $($(package)_staging_dir)/$(host_prefix)/native/bin/$(host)-ar &&\ + cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ranlib $($(package)_staging_dir)/$(host_prefix)/native/bin/$(host)-ranlib endef @@ -88,20 +103,38 @@ index fd06c5393..c17e863cc 100644 $(package)_cxxflags_freebsd=-fPIC endef +diff --git a/contrib/depends/packages/openssl.mk b/contrib/depends/packages/openssl.mk +index a157762c7..2430f6495 100644 +--- a/contrib/depends/packages/openssl.mk ++++ b/contrib/depends/packages/openssl.mk +@@ -34,7 +34,7 @@ $(package)_config_opts_x86_64_linux=linux-x86_64 + $(package)_config_opts_i686_linux=linux-generic32 + $(package)_config_opts_arm_linux=linux-generic32 + $(package)_config_opts_aarch64_linux=linux-generic64 +-$(package)_config_opts_arm_android=--static android-arm ++$(package)_config_opts_armv7a_android=--static android-arm + $(package)_config_opts_aarch64_android=--static android-arm64 + $(package)_config_opts_aarch64_darwin=darwin64-arm64-cc + $(package)_config_opts_riscv64_linux=linux-generic64 diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in -index f26655d68..96a95ceb8 100644 +index f118c754e..cc1d9b5c5 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in -@@ -104,16 +104,17 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") +@@ -100,20 +100,21 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + SET(LLVM_ENABLE_PIE OFF) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") + SET(ANDROID TRUE) +- if(ARCHITECTURE STREQUAL "arm") ++ if(ARCHITECTURE STREQUAL "armv7a") SET(CMAKE_ANDROID_ARCH_ABI "armeabi-v7a") SET(CMAKE_SYSTEM_PROCESSOR "armv7-a") SET(CMAKE_ANDROID_ARM_MODE ON) - SET(CMAKE_C_COMPILER_TARGET arm-linux-androideabi) - SET(CMAKE_CXX_COMPILER_TARGET arm-linux-androideabi) - SET(_CMAKE_TOOLCHAIN_PREFIX arm-linux-androideabi-) -+ SET(CMAKE_C_COMPILER_TARGET arm-linux-androideabi21) -+ SET(CMAKE_CXX_COMPILER_TARGET arm-linux-androideabi21) -+ SET(_CMAKE_TOOLCHAIN_PREFIX arm-linux-androideabi21-) ++ SET(CMAKE_C_COMPILER_TARGET armv7a-linux-androideabi21) ++ SET(CMAKE_CXX_COMPILER_TARGET armv7a-linux-androideabi21) ++ SET(_CMAKE_TOOLCHAIN_PREFIX armv7a-linux-androideabi21-) elseif(ARCHITECTURE STREQUAL "aarch64") SET(CMAKE_ANDROID_ARCH_ABI "arm64-v8a") SET(CMAKE_SYSTEM_PROCESSOR "aarch64") @@ -116,5 +149,5 @@ index f26655d68..96a95ceb8 100644 SET(CMAKE_C_COMPILER @CC@) SET(CMAKE_CXX_COMPILER @CXX@) -- -2.39.2 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0003-airgap.patch b/patches/monero/0003-airgap.patch deleted file mode 100644 index eebe0976..00000000 --- a/patches/monero/0003-airgap.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 5385d085c547b675adfccb64314d1c6f7bf2d508 Mon Sep 17 00:00:00 2001 -From: tobtoht -Date: Tue, 12 Mar 2024 10:09:50 +0100 -Subject: [PATCH 03/16] airgap - ---- - src/wallet/api/wallet.cpp | 23 ++++++++++++++++++ - src/wallet/api/wallet.h | 2 ++ - src/wallet/api/wallet2_api.h | 3 +++ - src/wallet/wallet2.cpp | 45 +++++++++++++++++++++++++++++++----- - src/wallet/wallet2.h | 1 + - 5 files changed, 68 insertions(+), 6 deletions(-) - -diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -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 - return m_wallet->unlocked_balance(accountIndex, false); - } - -+uint64_t WalletImpl::viewOnlyBalance(uint32_t accountIndex, const std::vector &key_images) const -+{ -+ clearStatus(); -+ -+ std::vector kis; -+ for (const auto &key_image : key_images) { -+ crypto::key_image ki; -+ if (!epee::string_tools::hex_to_pod(key_image, ki)) -+ { -+ setStatusError(tr("failed to parse key image")); -+ return 0; -+ } -+ kis.push_back(ki); -+ } -+ -+ return m_wallet->view_only_balance(accountIndex, kis); -+} -+ - uint64_t WalletImpl::blockChainHeight() const - { - if(m_wallet->light_wallet()) { -@@ -1291,6 +1309,11 @@ bool WalletImpl::submitTransaction(const string &fileName) { - return true; - } - -+bool WalletImpl::hasUnknownKeyImages() const -+{ -+ return m_wallet->has_unknown_key_images(); -+} -+ - bool WalletImpl::exportKeyImages(const string &filename, bool all) - { - if (m_wallet->watch_only()) -diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index 9acd2871f..05d065c5c 100644 ---- a/src/wallet/api/wallet.h -+++ b/src/wallet/api/wallet.h -@@ -122,6 +122,7 @@ public: - bool setProxy(const std::string &address) override; - uint64_t balance(uint32_t accountIndex = 0) const override; - uint64_t unlockedBalance(uint32_t accountIndex = 0) const override; -+ uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector &key_images) const override; - uint64_t blockChainHeight() const override; - uint64_t approximateBlockChainHeight() const override; - uint64_t estimateBlockChainHeight() const override; -@@ -175,6 +176,7 @@ public: - virtual PendingTransaction * createSweepUnmixableTransaction() override; - bool submitTransaction(const std::string &fileName) override; - virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override; -+ bool hasUnknownKeyImages() const override; - bool exportKeyImages(const std::string &filename, bool all = false) override; - bool importKeyImages(const std::string &filename) override; - bool exportOutputs(const std::string &filename, bool all = false) override; -diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index 4268b656e..4edaefefd 100644 ---- a/src/wallet/api/wallet2_api.h -+++ b/src/wallet/api/wallet2_api.h -@@ -626,6 +626,7 @@ struct Wallet - result += unlockedBalance(i); - return result; - } -+ virtual uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector &key_images = {}) const = 0; - - /** - * @brief watchOnly - checks if wallet is watch only -@@ -910,6 +911,8 @@ struct Wallet - virtual uint64_t estimateTransactionFee(const std::vector> &destinations, - PendingTransaction::Priority priority) const = 0; - -+ virtual bool hasUnknownKeyImages() const = 0; -+ - /*! - * \brief exportKeyImages - exports key images to file - * \param filename -diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -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) - return idx + extra; - } - -+bool is_preferred_input(const std::vector& preferred_input_list, const crypto::key_image& input) { -+ if (!preferred_input_list.empty()) { -+ auto it = std::find(preferred_input_list.begin(), preferred_input_list.end(), input); -+ if (it == preferred_input_list.end()) { -+ return false; -+ } -+ } -+ return true; -+} -+ - 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); -@@ -7038,6 +7048,25 @@ uint64_t wallet2::unlocked_balance(uint32_t index_major, bool strict, uint64_t * - return amount; - } - //---------------------------------------------------------------------------------------------------- -+uint64_t wallet2::view_only_balance(uint32_t index_major, const std::vector& selected_inputs) -+{ -+ uint64_t amount = 0; -+ for (const auto &td : m_transfers) { -+ if (is_preferred_input(selected_inputs, td.m_key_image) && -+ !is_spent(td, false) && -+ !td.m_frozen && -+ !td.m_key_image_partial && -+ td.m_key_image_known && -+ td.is_rct() && -+ is_transfer_unlocked(td) && -+ td.m_subaddr_index.major == index_major) -+ { -+ amount += td.m_amount; -+ } -+ } -+ return amount; -+} -+//---------------------------------------------------------------------------------------------------- - std::map wallet2::balance_per_subaddress(uint32_t index_major, bool strict) const - { - std::map amount_per_subaddr; -@@ -7889,9 +7918,7 @@ bool wallet2::sign_tx(unsigned_tx_set &exported_txs, std::vector additional_derivations; - -- // compute public keys from out secret keys -- crypto::public_key tx_pub_key; -- crypto::secret_key_to_public_key(txs[n].tx_key, tx_pub_key); -+ crypto::public_key tx_pub_key = get_tx_pub_key_from_extra(tx); - std::vector additional_tx_pub_keys; - for (const crypto::secret_key &skey: txs[n].additional_tx_keys) - { -@@ -11287,7 +11314,7 @@ std::vector wallet2::create_transactions_2(std::vector m_ignore_outputs_above || td.amount() < m_ignore_outputs_below) - { -@@ -11337,9 +11364,15 @@ std::vector wallet2::create_transactions_2(std::vector(); -+ // use tobotoht's code path on view-only wallet, otherwise default to upstream -+ bool throwOnNoEnotes = m_account.get_device().device_protocol() == hw::device::PROTOCOL_COLD || m_watch_only || m_multisig || m_is_background_wallet; - -+ if (throwOnNoEnotes) { -+ THROW_WALLET_EXCEPTION_IF(unused_dust_indices_per_subaddr.empty() && unused_transfers_indices_per_subaddr.empty(), error::wallet_internal_error, "No enotes available to spend") -+ } else { -+ if (unused_dust_indices_per_subaddr.empty() && unused_transfers_indices_per_subaddr.empty()) -+ return std::vector(); -+ } - // if empty, put dummy entry so that the front can be referenced later in the loop - 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 56cc118f4..b9aa7a00d 100644 ---- a/src/wallet/wallet2.h -+++ b/src/wallet/wallet2.h -@@ -1172,6 +1172,7 @@ private: - // locked & unlocked balance of given or current subaddress account - uint64_t balance(uint32_t subaddr_index_major, bool strict) const; - uint64_t unlocked_balance(uint32_t subaddr_index_major, bool strict, uint64_t *blocks_to_unlock = NULL, uint64_t *time_to_unlock = NULL); -+ uint64_t view_only_balance(uint32_t index_major, const std::vector& selected_inputs = {}); - // locked & unlocked balance per subaddress of given or current subaddress account - 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.39.2 - diff --git a/patches/monero/0016-uint64_t-missing-definition-fix.patch b/patches/monero/0004-uint64_t-missing-definition-fix.patch similarity index 79% rename from patches/monero/0016-uint64_t-missing-definition-fix.patch rename to patches/monero/0004-uint64_t-missing-definition-fix.patch index e555829d..b46d0dc8 100644 --- a/patches/monero/0016-uint64_t-missing-definition-fix.patch +++ b/patches/monero/0004-uint64_t-missing-definition-fix.patch @@ -1,7 +1,7 @@ -From 9fe376e0024dfdbea47219477e797cb20c56305f Mon Sep 17 00:00:00 2001 +From e8ca4e1446ad16c7ce2a5df26bb9c0e06dfa8b1e Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Mon, 2 Sep 2024 16:40:31 +0200 -Subject: [PATCH] uint64_t missing definition fix +Subject: [PATCH 04/11] uint64_t missing definition fix --- contrib/epee/include/net/http_base.h | 2 +- @@ -21,5 +21,5 @@ index 4af4da790..ae4c0d05e 100644 #include -- -2.43.0 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0005-fix-build-issues.patch b/patches/monero/0005-fix-build-issues.patch deleted file mode 100644 index 985df3ed..00000000 --- a/patches/monero/0005-fix-build-issues.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 0f1d5e1296dc1e8c9ee323fa7bdf706ff76df2a7 Mon Sep 17 00:00:00 2001 -From: Czarek Nakamoto -Date: Tue, 12 Mar 2024 17:59:13 +0100 -Subject: [PATCH 05/16] fix build issues - ---- - contrib/depends/hosts/linux.mk | 8 +++---- - contrib/depends/packages/android_ndk.mk | 2 ++ - contrib/depends/packages/packages.mk | 2 +- - contrib/depends/packages/polyseed.mk | 23 +++++++++++++++++++ - contrib/depends/packages/sodium.mk | 2 +- - .../patches/polyseed/force-static-mingw.patch | 23 +++++++++++++++++++ - 6 files changed, 54 insertions(+), 6 deletions(-) - create mode 100644 contrib/depends/packages/polyseed.mk - create mode 100644 contrib/depends/patches/polyseed/force-static-mingw.patch - -diff --git a/contrib/depends/hosts/linux.mk b/contrib/depends/hosts/linux.mk -index 912fdb03c..b79799f30 100644 ---- a/contrib/depends/hosts/linux.mk -+++ b/contrib/depends/hosts/linux.mk -@@ -11,15 +11,15 @@ linux_debug_CXXFLAGS=$(linux_debug_CFLAGS) - linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC - - ifeq (86,$(findstring 86,$(build_arch))) --i686_linux_CC=gcc -m32 --i686_linux_CXX=g++ -m32 -+i686_linux_CC=i686-linux-gnu-gcc -+i686_linux_CXX=i686-linux-gnu-g++ - i686_linux_AR=ar - i686_linux_RANLIB=ranlib - i686_linux_NM=nm - i686_linux_STRIP=strip - --x86_64_linux_CC=gcc -m64 --x86_64_linux_CXX=g++ -m64 -+x86_64_linux_CC=x86_64-linux-gnu-gcc -+x86_64_linux_CXX=x86_64-linux-gnu-g++ - x86_64_linux_AR=ar - x86_64_linux_RANLIB=ranlib - x86_64_linux_NM=nm -diff --git a/contrib/depends/packages/android_ndk.mk b/contrib/depends/packages/android_ndk.mk -index 9b8a5332f..5deff76c7 100644 ---- a/contrib/depends/packages/android_ndk.mk -+++ b/contrib/depends/packages/android_ndk.mk -@@ -7,6 +7,8 @@ $(package)_sha256_hash=5dfbbdc2d3ba859fed90d0e978af87c71a91a5be1f6e1c40ba697503d - define $(package)_set_vars - $(package)_config_opts_arm=--arch arm - $(package)_config_opts_aarch64=--arch arm64 -+$(package)_config_opts_x86_64=--arch x86_64 -+$(package)_config_opts_i686=--arch x86 - endef - - define $(package)_extract_cmds -diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk -index d2d1eca85..8783d4955 100644 ---- a/contrib/depends/packages/packages.mk -+++ b/contrib/depends/packages/packages.mk -@@ -1,4 +1,4 @@ --packages:=boost openssl zeromq libiconv expat unbound -+packages:=boost openssl zeromq libiconv expat unbound polyseed - - # ccache is useless in gitian builds - ifneq ($(GITIAN),1) -diff --git a/contrib/depends/packages/polyseed.mk b/contrib/depends/packages/polyseed.mk -new file mode 100644 -index 000000000..2ddeac621 ---- /dev/null -+++ b/contrib/depends/packages/polyseed.mk -@@ -0,0 +1,23 @@ -+package=polyseed -+$(package)_version=2.0.0 -+$(package)_download_path=https://github.com/tevador/$(package)/archive/refs/tags/ -+$(package)_download_file=v$($(package)_version).tar.gz -+$(package)_file_name=$(package)-$($(package)_version).tar.gz -+$(package)_sha256_hash=f36282fcbcd68d32461b8230c89e1a40661bd46b91109681cec637433004135a -+$(package)_patches=force-static-mingw.patch -+ -+define $(package)_preprocess_cmds -+ patch -p1 < $($(package)_patch_dir)/force-static-mingw.patch -+endef -+ -+define $(package)_config_cmds -+ cmake -DCMAKE_INSTALL_PREFIX=$(host_prefix) -DCMAKE_C_COMPILER=$($(package)_cc) . -+endef -+ -+define $(package)_build_cmds -+ $(MAKE) -+endef -+ -+define $(package)_stage_cmds -+ $(MAKE) DESTDIR=$($(package)_staging_dir) install -+endef -diff --git a/contrib/depends/packages/sodium.mk b/contrib/depends/packages/sodium.mk -index 87b34599e..68a5b48ba 100644 ---- a/contrib/depends/packages/sodium.mk -+++ b/contrib/depends/packages/sodium.mk -@@ -6,7 +6,7 @@ $(package)_sha256_hash=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e - $(package)_patches=disable-glibc-getrandom-getentropy.patch fix-whitespace.patch - - define $(package)_set_vars --$(package)_config_opts=--enable-static --disable-shared -+$(package)_config_opts=--enable-static --disable-shared --with-pic - $(package)_config_opts+=--prefix=$(host_prefix) - endef - -diff --git a/contrib/depends/patches/polyseed/force-static-mingw.patch b/contrib/depends/patches/polyseed/force-static-mingw.patch -new file mode 100644 -index 000000000..f05cb2b6a ---- /dev/null -+++ b/contrib/depends/patches/polyseed/force-static-mingw.patch -@@ -0,0 +1,23 @@ -+--- a/include/polyseed.h -++++ b/include/polyseed.h -+@@ -93,13 +93,13 @@ Shared/static library definitions -+ - define POLYSEED_STATIC when linking to the static library -+ */ -+ #if defined(_WIN32) || defined(__CYGWIN__) -+- #ifdef POLYSEED_SHARED -+- #define POLYSEED_API __declspec(dllexport) -+- #elif !defined(POLYSEED_STATIC) -+- #define POLYSEED_API __declspec(dllimport) -+- #else -+- #define POLYSEED_API -+- #endif -++// #ifdef POLYSEED_SHARED -++// #define POLYSEED_API __declspec(dllexport) -++// #elif !defined(POLYSEED_STATIC) -++// #define POLYSEED_API __declspec(dllimport) -++// #else -++ #define POLYSEED_API -++// #endif -+ #define POLYSEED_PRIVATE -+ #else -+ #ifdef POLYSEED_SHARED --- -2.39.2 - diff --git a/patches/monero/0015-use-proper-error-handling-in-get_seed.patch b/patches/monero/0005-use-proper-error-handling-in-get_seed.patch similarity index 74% rename from patches/monero/0015-use-proper-error-handling-in-get_seed.patch rename to patches/monero/0005-use-proper-error-handling-in-get_seed.patch index aef7dcf7..92602de2 100644 --- a/patches/monero/0015-use-proper-error-handling-in-get_seed.patch +++ b/patches/monero/0005-use-proper-error-handling-in-get_seed.patch @@ -1,18 +1,18 @@ -From 6e7a9770e4f18f931f5caca7dec2a197e779afbc Mon Sep 17 00:00:00 2001 +From 234d235ad83de3d11631dc317f74abd640b472c4 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Mon, 24 Jun 2024 10:49:12 +0200 -Subject: [PATCH 15/16] use proper error handling in get_seed +Subject: [PATCH 05/11] use proper error handling in get_seed --- src/wallet/api/wallet.cpp | 17 ++++++++++++----- - src/wallet/wallet2.cpp | 3 +++ - 2 files changed, 15 insertions(+), 5 deletions(-) + src/wallet/wallet2.cpp | 5 ++++- + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 5ca190c7d..a307d35a7 100644 +index 0d85cf359..dfbf4fd28 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp -@@ -880,12 +880,19 @@ bool WalletImpl::close(bool store) +@@ -826,12 +826,19 @@ bool WalletImpl::close(bool store) std::string WalletImpl::seed(const std::string& seed_offset) const { @@ -36,12 +36,12 @@ index 5ca190c7d..a307d35a7 100644 + } } - bool WalletImpl::getPolyseed(std::string &seed_words, std::string &passphrase) const + std::string WalletImpl::getSeedLanguage() const diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index 7d97e683b..8e44806fc 100644 +index aa61fb298..5ffeda2ec 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 +@@ -1440,11 +1440,13 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab bool keys_deterministic = is_deterministic(); if (!keys_deterministic) { @@ -55,14 +55,17 @@ index 7d97e683b..8e44806fc 100644 std::cout << "seed_language not set" << std::endl; return false; } -@@ -1466,6 +1468,7 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab +@@ -1454,8 +1456,9 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab key = cryptonote::encrypt_key(key, passphrase); if (!crypto::ElectrumWords::bytes_to_words(key, electrum_words, seed_language)) { + THROW_WALLET_EXCEPTION(error::wallet_internal_error, "Failed to create seed from key for language: "+seed_language+", falling back to English."); - std::cout << "Failed to create seed from key for language: " << seed_language << ", falling back to English." << std::endl; - crypto::ElectrumWords::bytes_to_words(key, electrum_words, "English"); + std::cout << "Failed to create seed from key for language: " << seed_language << std::endl; +- return false; ++ crypto::ElectrumWords::bytes_to_words(key, electrum_words, "English"); } + + return true; -- -2.39.2 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0012-WIP-UR-functions.patch b/patches/monero/0006-UR-functions.patch similarity index 78% rename from patches/monero/0012-WIP-UR-functions.patch rename to patches/monero/0006-UR-functions.patch index 564be97d..e2b08f49 100644 --- a/patches/monero/0012-WIP-UR-functions.patch +++ b/patches/monero/0006-UR-functions.patch @@ -1,7 +1,7 @@ -From 1b938a3f98468de3fa06b21a458104cf32831586 Mon Sep 17 00:00:00 2001 -From: Czarek Nakamoto -Date: Thu, 16 May 2024 17:28:59 +0200 -Subject: [PATCH 12/16] WIP: UR functions +From a6672235422519749ffec4d20cfce6c418863a1c Mon Sep 17 00:00:00 2001 +From: tobtoht +Date: Tue, 12 Mar 2024 10:09:50 +0100 +Subject: [PATCH 06/11] UR functions This commit adds UR functions for UR tasks, I believe that the right place to get @@ -19,7 +19,7 @@ Things broken in the commit later. However (considering the purpose of this patch) it is not a dealbreaker. --- - .gitmodules | 3 + + .gitmodules | 4 + CMakeLists.txt | 4 +- contrib/depends/hosts/darwin.mk | 2 +- contrib/depends/toolchain.cmake.in | 2 +- @@ -31,27 +31,28 @@ Things broken in the commit src/wallet/api/pending_transaction.h | 1 + src/wallet/api/unsigned_transaction.cpp | 42 ++++ src/wallet/api/unsigned_transaction.h | 1 + - src/wallet/api/wallet.cpp | 286 +++++++++++++++++++++++- - src/wallet/api/wallet.h | 6 + - src/wallet/api/wallet2_api.h | 19 +- - src/wallet/wallet2.cpp | 96 ++++---- - src/wallet/wallet2.h | 2 + - 17 files changed, 452 insertions(+), 53 deletions(-) + src/wallet/api/wallet.cpp | 309 +++++++++++++++++++++++- + src/wallet/api/wallet.h | 8 + + src/wallet/api/wallet2_api.h | 22 +- + src/wallet/wallet2.cpp | 141 +++++++---- + src/wallet/wallet2.h | 3 + + 17 files changed, 521 insertions(+), 59 deletions(-) create mode 160000 external/bc-ur diff --git a/.gitmodules b/.gitmodules -index 7ea87a009..a7e1d2cd0 100644 +index 721cce3b4..d1896924a 100644 --- a/.gitmodules +++ b/.gitmodules -@@ -20,3 +20,6 @@ +@@ -14,3 +14,7 @@ path = external/supercop url = https://github.com/monero-project/supercop branch = monero +[submodule "external/bc-ur"] + path = external/bc-ur + url = https://github.com/MrCyjaneK/bc-ur ++ branch = misc diff --git a/CMakeLists.txt b/CMakeLists.txt -index 63b8c5079..6028c0961 100644 +index 8fb03ba1f..63ee8252d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,8 @@ enable_language(C ASM) @@ -73,7 +74,7 @@ index 63b8c5079..6028c0961 100644 check_submodule(external/rapidjson) check_submodule(external/trezor-common) diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk -index cbe795081..b14ee5c5b 100644 +index 79d449054..83d83036b 100644 --- a/contrib/depends/hosts/darwin.mk +++ b/contrib/depends/hosts/darwin.mk @@ -1,4 +1,4 @@ @@ -83,7 +84,7 @@ index cbe795081..b14ee5c5b 100644 ifeq (aarch64, $(host_arch)) CC_target=arm64-apple-$(host_os) diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in -index f118c754e..f26655d68 100644 +index cc1d9b5c5..48a6f947e 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -94,7 +94,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") @@ -96,18 +97,15 @@ index f118c754e..f26655d68 100644 SET(LLVM_ENABLE_PIC OFF) SET(LLVM_ENABLE_PIE OFF) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index 1b9761d70..0df9f9116 100644 +index 5b7f69a56..f9ed6a69a 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt -@@ -69,6 +69,7 @@ endif() +@@ -69,4 +69,5 @@ endif() add_subdirectory(db_drivers) add_subdirectory(easylogging++) add_subdirectory(qrcodegen) +add_subdirectory(bc-ur) add_subdirectory(randomx EXCLUDE_FROM_ALL) - add_subdirectory(polyseed EXCLUDE_FROM_ALL) - add_subdirectory(utf8proc EXCLUDE_FROM_ALL) -\ No newline at end of file diff --git a/external/bc-ur b/external/bc-ur new file mode 160000 index 000000000..d82e7c753 @@ -116,7 +114,7 @@ index 000000000..d82e7c753 @@ -0,0 +1 @@ +Subproject commit d82e7c753e710b8000706dc3383b498438795208 diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp -index a4b5f3ef0..90675df11 100644 +index 5d0afe1ee..bb5b6f497 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp @@ -313,12 +313,13 @@ namespace hw { @@ -148,7 +146,7 @@ index 6095f99d5..b163212b7 100644 common cryptonote_core diff --git a/src/wallet/api/pending_transaction.cpp b/src/wallet/api/pending_transaction.cpp -index be20b478c..1f714d229 100644 +index 70a702796..9c3c26ee5 100644 --- a/src/wallet/api/pending_transaction.cpp +++ b/src/wallet/api/pending_transaction.cpp @@ -42,6 +42,8 @@ @@ -160,7 +158,7 @@ index be20b478c..1f714d229 100644 using namespace std; namespace Monero { -@@ -178,6 +180,37 @@ bool PendingTransactionImpl::commit(const std::string &filename, bool overwrite) +@@ -162,6 +164,37 @@ bool PendingTransactionImpl::commit(const std::string &filename, bool overwrite) return m_status == Status_Ok; } @@ -199,7 +197,7 @@ index be20b478c..1f714d229 100644 { uint64_t result = 0; diff --git a/src/wallet/api/pending_transaction.h b/src/wallet/api/pending_transaction.h -index 2fbaa83d9..0cc6c58e9 100644 +index 0a9779c07..403bfe281 100644 --- a/src/wallet/api/pending_transaction.h +++ b/src/wallet/api/pending_transaction.h @@ -46,6 +46,7 @@ public: @@ -283,10 +281,10 @@ index 30065a7fa..a94b23f75 100644 uint64_t minMixinCount() const override; diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 306c9b8ae..5ca190c7d 100644 +index dfbf4fd28..4fb5f7595 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp -@@ -48,6 +48,7 @@ +@@ -47,6 +47,7 @@ #include #include @@ -294,7 +292,32 @@ index 306c9b8ae..5ca190c7d 100644 using namespace std; using namespace cryptonote; -@@ -1321,6 +1322,61 @@ UnsignedTransaction *WalletImpl::loadUnsignedTx(const std::string &unsigned_file +@@ -1066,6 +1067,24 @@ uint64_t WalletImpl::unlockedBalance(uint32_t accountIndex) const + return m_wallet->unlocked_balance(accountIndex, false); + } + ++uint64_t WalletImpl::viewOnlyBalance(uint32_t accountIndex, const std::vector &key_images) const ++{ ++ clearStatus(); ++ ++ std::vector kis; ++ for (const auto &key_image : key_images) { ++ crypto::key_image ki; ++ if (!epee::string_tools::hex_to_pod(key_image, ki)) ++ { ++ setStatusError(tr("failed to parse key image")); ++ return 0; ++ } ++ kis.push_back(ki); ++ } ++ ++ return m_wallet->view_only_balance(accountIndex, kis); ++} ++ + uint64_t WalletImpl::blockChainHeight() const + { + if(m_wallet->light_wallet()) { +@@ -1208,6 +1227,61 @@ UnsignedTransaction *WalletImpl::loadUnsignedTx(const std::string &unsigned_file return transaction; } @@ -356,7 +379,7 @@ index 306c9b8ae..5ca190c7d 100644 bool WalletImpl::submitTransaction(const string &fileName) { clearStatus(); if (checkBackgroundSync("cannot submit tx")) -@@ -1332,7 +1388,7 @@ bool WalletImpl::submitTransaction(const string &fileName) { +@@ -1219,7 +1293,7 @@ bool WalletImpl::submitTransaction(const string &fileName) { setStatus(Status_Ok, tr("Failed to load transaction from file")); return false; } @@ -365,7 +388,7 @@ index 306c9b8ae..5ca190c7d 100644 if(!transaction->commit()) { setStatusError(transaction->m_errorString); return false; -@@ -1341,6 +1397,56 @@ bool WalletImpl::submitTransaction(const string &fileName) { +@@ -1228,6 +1302,61 @@ bool WalletImpl::submitTransaction(const string &fileName) { return true; } @@ -419,10 +442,15 @@ index 306c9b8ae..5ca190c7d 100644 +} + + - bool WalletImpl::hasUnknownKeyImages() const ++bool WalletImpl::hasUnknownKeyImages() const ++{ ++ return m_wallet->has_unknown_key_images(); ++} ++ + bool WalletImpl::exportKeyImages(const string &filename, bool all) { - return m_wallet->has_unknown_key_images(); -@@ -1373,6 +1479,39 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) + if (m_wallet->watch_only()) +@@ -1255,6 +1384,39 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) return true; } @@ -462,7 +490,7 @@ index 306c9b8ae..5ca190c7d 100644 bool WalletImpl::importKeyImages(const string &filename) { if (checkBackgroundSync("cannot import key images")) -@@ -1398,6 +1537,62 @@ bool WalletImpl::importKeyImages(const string &filename) +@@ -1280,6 +1442,62 @@ bool WalletImpl::importKeyImages(const string &filename) return true; } @@ -525,7 +553,7 @@ index 306c9b8ae..5ca190c7d 100644 bool WalletImpl::exportOutputs(const string &filename, bool all) { if (checkBackgroundSync("cannot export outputs")) -@@ -1430,6 +1625,40 @@ bool WalletImpl::exportOutputs(const string &filename, bool all) +@@ -1312,6 +1530,40 @@ bool WalletImpl::exportOutputs(const string &filename, bool all) return true; } @@ -566,7 +594,7 @@ index 306c9b8ae..5ca190c7d 100644 bool WalletImpl::importOutputs(const string &filename) { if (checkBackgroundSync("cannot import outputs")) -@@ -1464,6 +1693,61 @@ bool WalletImpl::importOutputs(const string &filename) +@@ -1346,6 +1598,61 @@ bool WalletImpl::importOutputs(const string &filename) return true; } @@ -629,17 +657,25 @@ index 306c9b8ae..5ca190c7d 100644 { if (checkBackgroundSync("cannot scan transactions")) diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index 2ad2b62a4..febc93119 100644 +index ac7ce2f6a..edf8bb8ce 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h -@@ -182,12 +182,18 @@ public: - const std::set &preferred_inputs = {}) override; +@@ -112,6 +112,7 @@ public: + bool setProxy(const std::string &address) override; + uint64_t balance(uint32_t accountIndex = 0) const override; + uint64_t unlockedBalance(uint32_t accountIndex = 0) const override; ++ uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector &key_images) const override; + uint64_t blockChainHeight() const override; + uint64_t approximateBlockChainHeight() const override; + uint64_t estimateBlockChainHeight() const override; +@@ -164,11 +165,18 @@ public: + std::set subaddr_indices = {}) override; virtual PendingTransaction * createSweepUnmixableTransaction() override; bool submitTransaction(const std::string &fileName) override; + bool submitTransactionUR(const std::string &input) override; virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override; + virtual UnsignedTransaction * loadUnsignedTxUR(const std::string &input) override; - bool hasUnknownKeyImages() const override; ++ bool hasUnknownKeyImages() const override; bool exportKeyImages(const std::string &filename, bool all = false) override; + std::string exportKeyImagesUR(size_t max_fragment_length, bool all = false) override; bool importKeyImages(const std::string &filename) override; @@ -652,7 +688,7 @@ index 2ad2b62a4..febc93119 100644 bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional &background_cache_password = optional()) override; diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index 1c3a11c39..2bbb32c8b 100644 +index e349df176..764adbfbf 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -91,6 +91,7 @@ struct PendingTransaction @@ -663,7 +699,7 @@ index 1c3a11c39..2bbb32c8b 100644 virtual uint64_t amount() const = 0; virtual uint64_t dust() const = 0; virtual uint64_t fee() const = 0; -@@ -162,7 +163,8 @@ struct UnsignedTransaction +@@ -160,7 +161,8 @@ struct UnsignedTransaction * @param signedFileName * return - true on success */ @@ -673,7 +709,15 @@ index 1c3a11c39..2bbb32c8b 100644 }; /** -@@ -938,13 +940,15 @@ struct Wallet +@@ -626,6 +628,7 @@ struct Wallet + result += unlockedBalance(i); + return result; + } ++ virtual uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector &key_images = {}) const = 0; + + /** + * @brief watchOnly - checks if wallet is watch only +@@ -884,13 +887,15 @@ struct Wallet * after object returned */ virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0; @@ -692,7 +736,16 @@ index 1c3a11c39..2bbb32c8b 100644 /*! * \brief disposeTransaction - destroys transaction object -@@ -969,20 +973,22 @@ struct Wallet +@@ -906,6 +911,8 @@ struct Wallet + virtual uint64_t estimateTransactionFee(const std::vector> &destinations, + PendingTransaction::Priority priority) const = 0; + ++ virtual bool hasUnknownKeyImages() const = 0; ++ + /*! + * \brief exportKeyImages - exports key images to file + * \param filename +@@ -913,20 +920,22 @@ struct Wallet * \return - true on success */ virtual bool exportKeyImages(const std::string &filename, bool all = false) = 0; @@ -717,7 +770,7 @@ index 1c3a11c39..2bbb32c8b 100644 /*! * \brief importOutputs - imports outputs from file -@@ -990,6 +996,7 @@ struct Wallet +@@ -934,6 +943,7 @@ struct Wallet * \return - true on success */ virtual bool importOutputs(const std::string &filename) = 0; @@ -726,10 +779,91 @@ 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 4de226a4a..7d97e683b 100644 +index 5ffeda2ec..4f58d7aea 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp -@@ -14056,33 +14056,40 @@ crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::walle +@@ -948,6 +948,16 @@ uint32_t get_subaddress_clamped_sum(uint32_t idx, uint32_t extra) + return idx + extra; + } + ++bool is_preferred_input(const std::vector& preferred_input_list, const crypto::key_image& input) { ++ if (!preferred_input_list.empty()) { ++ auto it = std::find(preferred_input_list.begin(), preferred_input_list.end(), input); ++ if (it == preferred_input_list.end()) { ++ return false; ++ } ++ } ++ return true; ++} ++ + 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); +@@ -6987,6 +6997,25 @@ uint64_t wallet2::unlocked_balance(uint32_t index_major, bool strict, uint64_t * + return amount; + } + //---------------------------------------------------------------------------------------------------- ++uint64_t wallet2::view_only_balance(uint32_t index_major, const std::vector& selected_inputs) ++{ ++ uint64_t amount = 0; ++ for (const auto &td : m_transfers) { ++ if (is_preferred_input(selected_inputs, td.m_key_image) && ++ !is_spent(td, false) && ++ !td.m_frozen && ++ !td.m_key_image_partial && ++ td.m_key_image_known && ++ td.is_rct() && ++ is_transfer_unlocked(td) && ++ td.m_subaddr_index.major == index_major) ++ { ++ amount += td.m_amount; ++ } ++ } ++ return amount; ++} ++//---------------------------------------------------------------------------------------------------- + std::map wallet2::balance_per_subaddress(uint32_t index_major, bool strict) const + { + std::map amount_per_subaddr; +@@ -7838,9 +7867,7 @@ bool wallet2::sign_tx(unsigned_tx_set &exported_txs, std::vector additional_derivations; + +- // compute public keys from out secret keys +- crypto::public_key tx_pub_key; +- crypto::secret_key_to_public_key(txs[n].tx_key, tx_pub_key); ++ crypto::public_key tx_pub_key = get_tx_pub_key_from_extra(tx); + std::vector additional_tx_pub_keys; + for (const crypto::secret_key &skey: txs[n].additional_tx_keys) + { +@@ -11236,7 +11263,7 @@ std::vector wallet2::create_transactions_2(std::vector m_ignore_outputs_above || td.amount() < m_ignore_outputs_below) + { +@@ -11286,9 +11313,15 @@ std::vector wallet2::create_transactions_2(std::vector(); ++ // use tobotoht's code path on view-only wallet, otherwise default to upstream ++ bool throwOnNoEnotes = m_account.get_device().device_protocol() == hw::device::PROTOCOL_COLD || m_watch_only || m_multisig || m_is_background_wallet; + ++ if (throwOnNoEnotes) { ++ THROW_WALLET_EXCEPTION_IF(unused_dust_indices_per_subaddr.empty() && unused_transfers_indices_per_subaddr.empty(), error::wallet_internal_error, "No enotes available to spend") ++ } else { ++ if (unused_dust_indices_per_subaddr.empty() && unused_transfers_indices_per_subaddr.empty()) ++ return std::vector(); ++ } + // if empty, put dummy entry so that the front can be referenced later in the loop + if (unused_dust_indices_per_subaddr.empty()) + unused_dust_indices_per_subaddr.push_back({}); +@@ -13924,33 +13957,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 { @@ -763,7 +897,11 @@ index 4de226a4a..7d97e683b 100644 + std::string magic(KEY_IMAGE_EXPORT_FILE_MAGIC, strlen(KEY_IMAGE_EXPORT_FILE_MAGIC)); + const cryptonote::account_public_address &keys = get_account().get_keys().m_account_address; + const uint32_t offset = ski.first; -+ + +- // encrypt data, keep magic plaintext +- PERF_TIMER(export_key_images_encrypt); +- std::string ciphertext = encrypt_with_view_secret_key(data); +- return save_to_file(filename, magic + ciphertext); + std::string data; + data.reserve(4 + ski.second.size() * (sizeof(crypto::key_image) + sizeof(crypto::signature)) + 2 * sizeof(crypto::public_key)); + data.resize(4); @@ -778,11 +916,7 @@ index 4de226a4a..7d97e683b 100644 + data += std::string((const char *)&i.first, sizeof(crypto::key_image)); + data += std::string((const char *)&i.second, sizeof(crypto::signature)); + } - -- // encrypt data, keep magic plaintext -- PERF_TIMER(export_key_images_encrypt); -- std::string ciphertext = encrypt_with_view_secret_key(data); -- return save_to_file(filename, magic + ciphertext); ++ + // encrypt data, keep magic plaintext + PERF_TIMER(export_key_images_encrypt); + std::string ciphertext = encrypt_with_view_secret_key(data); @@ -793,7 +927,7 @@ index 4de226a4a..7d97e683b 100644 //---------------------------------------------------------------------------------------------------- std::pair>> wallet2::export_key_images(bool all) const { -@@ -14137,53 +14144,60 @@ std::pair> +@@ -14005,53 +14045,60 @@ std::pair> return std::make_pair(offset, ski); } @@ -873,10 +1007,18 @@ index 4de226a4a..7d97e683b 100644 ski.push_back(std::make_pair(key_image, signature)); } diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h -index 3ce710433..9ff169a40 100644 +index a050286bc..1d7e430b9 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h -@@ -1650,9 +1650,11 @@ private: +@@ -1150,6 +1150,7 @@ private: + // locked & unlocked balance of given or current subaddress account + uint64_t balance(uint32_t subaddr_index_major, bool strict) const; + uint64_t unlocked_balance(uint32_t subaddr_index_major, bool strict, uint64_t *blocks_to_unlock = NULL, uint64_t *time_to_unlock = NULL); ++ uint64_t view_only_balance(uint32_t index_major, const std::vector& selected_inputs = {}); + // locked & unlocked balance per subaddress of given or current subaddress account + 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); +@@ -1624,9 +1625,11 @@ private: std::tuple> export_blockchain() const; void import_blockchain(const std::tuple> &bc); bool export_key_images(const std::string &filename, bool all = false) const; @@ -889,5 +1031,5 @@ index 3ce710433..9ff169a40 100644 bool import_key_images(signed_tx_set & signed_tx, size_t offset=0, bool only_selected_transfers=false); crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const; -- -2.39.2 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0006-macos-build-fix.patch b/patches/monero/0006-macos-build-fix.patch deleted file mode 100644 index f7c48b9f..00000000 --- a/patches/monero/0006-macos-build-fix.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 3343e3fbbd05546b3858c98afe3bad4673f250c8 Mon Sep 17 00:00:00 2001 -From: Your Name -Date: Thu, 28 Mar 2024 02:03:08 +0100 -Subject: [PATCH 06/16] macos build fix - ---- - contrib/depends/hosts/darwin.mk | 2 + - contrib/depends/packages/polyseed.mk | 13 +++-- - .../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 -index 79d449054..cbe795081 100644 ---- a/contrib/depends/hosts/darwin.mk -+++ b/contrib/depends/hosts/darwin.mk -@@ -8,6 +8,8 @@ endif - darwin_CC=clang -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -B$(host_prefix)/native/bin/$(host)- - darwin_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B$(host_prefix)/native/bin/$(host)- - -+darwin_RANLIB=$(host_prefix)/native/bin/$(host)-ranlib -+ - darwin_CFLAGS=-pipe - darwin_CXXFLAGS=$(darwin_CFLAGS) - darwin_ARFLAGS=cr -diff --git a/contrib/depends/packages/polyseed.mk b/contrib/depends/packages/polyseed.mk -index 2ddeac621..0071b20f3 100644 ---- a/contrib/depends/packages/polyseed.mk -+++ b/contrib/depends/packages/polyseed.mk -@@ -4,18 +4,23 @@ $(package)_download_path=https://github.com/tevador/$(package)/archive/refs/tags - $(package)_download_file=v$($(package)_version).tar.gz - $(package)_file_name=$(package)-$($(package)_version).tar.gz - $(package)_sha256_hash=f36282fcbcd68d32461b8230c89e1a40661bd46b91109681cec637433004135a --$(package)_patches=force-static-mingw.patch -+$(package)_patches=force-static-mingw.patch 0001-disable-soname.patch - - define $(package)_preprocess_cmds -- patch -p1 < $($(package)_patch_dir)/force-static-mingw.patch -+ patch -p1 < $($(package)_patch_dir)/force-static-mingw.patch &&\ -+ patch -p1 < $($(package)_patch_dir)/0001-disable-soname.patch - endef - - define $(package)_config_cmds -- cmake -DCMAKE_INSTALL_PREFIX=$(host_prefix) -DCMAKE_C_COMPILER=$($(package)_cc) . -+ CC="$($(package)_cc)" cmake -DCMAKE_INSTALL_PREFIX="$(host_prefix)" . -+endef -+ -+define $(package)_set_vars -+ $(package)_build_opts=CC="$($(package)_cc)" - endef - - define $(package)_build_cmds -- $(MAKE) -+ CC="$($(package)_cc)" $(MAKE) - endef - - 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..bd97dd394 ---- /dev/null -+++ b/contrib/depends/patches/polyseed/0001-disable-soname.patch -@@ -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 -+Subject: [PATCH] disable soname -+ -+--- -+ CMakeLists.txt | 16 +++++++++------- -+ 1 file changed, 9 insertions(+), 7 deletions(-) -+ -+diff --git a/CMakeLists.txt b/CMakeLists.txt -+index 8a8e7c2..5301353 100644 -+--- a/CMakeLists.txt -++++ b/CMakeLists.txt -+@@ -36,6 +36,7 @@ include_directories(polyseed -+ target_compile_definitions(polyseed PRIVATE POLYSEED_SHARED) -+ set_target_properties(polyseed PROPERTIES VERSION 2.0.0 -+ SOVERSION 2 -++ 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) -+ set_target_properties(polyseed_static PROPERTIES OUTPUT_NAME polyseed -++ NO_SONAME 1 -+ C_STANDARD 11 -+ C_STANDARD_REQUIRED ON) -+ -+-add_executable(polyseed-tests -+- tests/tests.c) -+-include_directories(polyseed-tests -+- include/) -+-target_compile_definitions(polyseed-tests PRIVATE POLYSEED_STATIC) -+-target_link_libraries(polyseed-tests -+- PRIVATE polyseed_static) -++# add_executable(polyseed-tests -++# tests/tests.c) -++# include_directories(polyseed-tests -++# include/) -++# 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.39.2 - diff --git a/patches/monero/0016-add-dummy-device-for-ledger.patch b/patches/monero/0007-add-dummy-device-for-ledger.patch similarity index 97% rename from patches/monero/0016-add-dummy-device-for-ledger.patch rename to patches/monero/0007-add-dummy-device-for-ledger.patch index d4ab5fea..af812dc4 100644 --- a/patches/monero/0016-add-dummy-device-for-ledger.patch +++ b/patches/monero/0007-add-dummy-device-for-ledger.patch @@ -1,7 +1,7 @@ -From 6b40191d35df998280e1d6e19ff9bf4bce54d5bf Mon Sep 17 00:00:00 2001 +From b1aa9f60da16ea296e524a0b9966f1a5f794bf48 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Wed, 26 Jun 2024 15:04:38 +0200 -Subject: [PATCH 16/16] add dummy device for ledger +Subject: [PATCH 07/11] add dummy device for ledger --- CMakeLists.txt | 6 +- @@ -20,10 +20,10 @@ Subject: [PATCH 16/16] add dummy device for ledger create mode 100644 src/device/device_io_dummy.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6028c0961..e7fa90abb 100644 +index 63ee8252d..43ef6cd20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -694,8 +694,12 @@ include_directories(${LMDB_INCLUDE}) +@@ -692,8 +692,12 @@ include_directories(${LMDB_INCLUDE}) include_directories(${LIBUNWIND_INCLUDE}) link_directories(${LIBUNWIND_LIBRARY_DIRS}) @@ -349,7 +349,7 @@ index 000000000..a1733616d + +#endif // HAVE_HIDAPI diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp -index 90675df11..136c6094b 100644 +index bb5b6f497..d405b86f2 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp @@ -41,7 +41,7 @@ namespace hw { @@ -370,7 +370,7 @@ index 90675df11..136c6094b 100644 this->mode = NONE; this->has_view_key = false; this->tx_in_progress = false; -@@ -532,7 +532,9 @@ namespace hw { +@@ -533,7 +533,9 @@ namespace hw { bool device_ledger::connect(void) { this->disconnect(); @@ -414,10 +414,10 @@ 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 a307d35a7..3ead385ec 100644 +index 4fb5f7595..ec79482ac 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp -@@ -49,6 +49,9 @@ +@@ -48,6 +48,9 @@ #include #include #include "bc-ur/src/bc-ur.hpp" @@ -427,7 +427,7 @@ index a307d35a7..3ead385ec 100644 using namespace std; using namespace cryptonote; -@@ -3298,4 +3301,94 @@ uint64_t WalletImpl::getBytesSent() +@@ -3178,4 +3181,94 @@ uint64_t WalletImpl::getBytesSent() return m_wallet->get_bytes_sent(); } @@ -523,10 +523,10 @@ index a307d35a7..3ead385ec 100644 + } // namespace diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index febc93119..9e1fbb40b 100644 +index edf8bb8ce..4e9c21ecb 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h -@@ -321,6 +321,24 @@ private: +@@ -301,6 +301,24 @@ private: // cache connection status to avoid unnecessary RPC calls mutable std::atomic m_is_connected; boost::optional m_daemon_login{}; @@ -552,10 +552,10 @@ index febc93119..9e1fbb40b 100644 diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index 2bbb32c8b..c8d6bb179 100644 +index 764adbfbf..53ec4abfc 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h -@@ -1204,6 +1204,18 @@ struct Wallet +@@ -1150,6 +1150,18 @@ struct Wallet //! get bytes sent virtual uint64_t getBytesSent() = 0; @@ -575,5 +575,5 @@ index 2bbb32c8b..c8d6bb179 100644 /** -- -2.39.2 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0007-fix-make-debug-test-target.patch b/patches/monero/0007-fix-make-debug-test-target.patch deleted file mode 100644 index f39c49ed..00000000 --- a/patches/monero/0007-fix-make-debug-test-target.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 8945e9865ef831f85ef58ba3d269f4b17d0270b5 Mon Sep 17 00:00:00 2001 -From: Czarek Nakamoto -Date: Tue, 2 Apr 2024 01:13:12 +0200 -Subject: [PATCH 07/16] fix `make debug-test` target - ---- - 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 f8ed6659c..0aa76b668 100644 ---- a/src/simplewallet/simplewallet.cpp -+++ b/src/simplewallet/simplewallet.cpp -@@ -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); - - 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.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 deleted file mode 100644 index 5b46d7c8..00000000 --- a/patches/monero/0008-fix-missing-___clear_cache-when-targetting-iOS.patch +++ /dev/null @@ -1,33 +0,0 @@ -From c7f8510fb4bfb54707053603f5cbcaa8c0bf72d2 Mon Sep 17 00:00:00 2001 -From: Czarek Nakamoto -Date: Tue, 2 Apr 2024 16:51:56 +0200 -Subject: [PATCH 08/16] fix missing ___clear_cache when targetting iOS - ---- - .gitmodules | 2 +- - external/randomx | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/.gitmodules b/.gitmodules -index 73a23fb35..7ea87a009 100644 ---- a/.gitmodules -+++ b/.gitmodules -@@ -9,7 +9,7 @@ - url = https://github.com/trezor/trezor-common.git - [submodule "external/randomx"] - path = external/randomx -- url = https://github.com/tevador/RandomX -+ url = https://github.com/MrCyjaneK/RandomX - [submodule "external/utf8proc"] - path = external/utf8proc - url = https://github.com/JuliaStrings/utf8proc.git -diff --git a/external/randomx b/external/randomx -index 102f8acf9..ce72c9bb9 160000 ---- a/external/randomx -+++ b/external/randomx -@@ -1 +1 @@ --Subproject commit 102f8acf90a7649ada410de5499a7ec62e49e1da -+Subproject commit ce72c9bb9cb799e0d9171094b9abb009e04c5bfc --- -2.39.2 - diff --git a/patches/monero/0001-polyseed.patch b/patches/monero/0008-polyseed.patch similarity index 91% rename from patches/monero/0001-polyseed.patch rename to patches/monero/0008-polyseed.patch index 81644034..f2919453 100644 --- a/patches/monero/0001-polyseed.patch +++ b/patches/monero/0008-polyseed.patch @@ -1,7 +1,7 @@ -From 8324040dfb89bd90b414ea685b2aa758a461fbc4 Mon Sep 17 00:00:00 2001 +From cf9e1b3b6a2baed010b8b2e4479666b733322ba0 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 12 Mar 2024 09:42:37 +0100 -Subject: [PATCH 01/16] polyseed +Subject: [PATCH 08/11] polyseed Co-authored-by: Czarek Nakamoto --- @@ -10,6 +10,8 @@ Co-authored-by: Czarek Nakamoto 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 +++- @@ -20,14 +22,16 @@ Co-authored-by: Czarek Nakamoto src/polyseed/pbkdf2.h | 46 +++++++ src/polyseed/polyseed.cpp | 182 +++++++++++++++++++++++++ src/polyseed/polyseed.hpp | 167 +++++++++++++++++++++++ - src/wallet/api/wallet.cpp | 71 ++++++++++ + src/wallet/api/wallet.cpp | 70 ++++++++++ src/wallet/api/wallet.h | 10 ++ src/wallet/api/wallet2_api.h | 25 ++++ src/wallet/api/wallet_manager.cpp | 9 ++ src/wallet/api/wallet_manager.h | 10 ++ - src/wallet/wallet2.cpp | 102 ++++++++++++-- + src/wallet/wallet2.cpp | 100 ++++++++++++-- src/wallet/wallet2.h | 30 +++- - 22 files changed, 805 insertions(+), 19 deletions(-) + 24 files changed, 805 insertions(+), 18 deletions(-) + create mode 160000 external/polyseed + create mode 160000 external/utf8proc create mode 100644 src/polyseed/CMakeLists.txt create mode 100644 src/polyseed/pbkdf2.c create mode 100644 src/polyseed/pbkdf2.h @@ -35,7 +39,7 @@ Co-authored-by: Czarek Nakamoto create mode 100644 src/polyseed/polyseed.hpp diff --git a/.gitmodules b/.gitmodules -index 721cce3b4..73a23fb35 100644 +index d1896924a..36fa3058a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,6 +10,12 @@ @@ -52,10 +56,10 @@ index 721cce3b4..73a23fb35 100644 path = external/supercop url = https://github.com/monero-project/supercop diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8fb03ba1f..63b8c5079 100644 +index 43ef6cd20..e7fa90abb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -369,6 +369,8 @@ if(NOT MANUAL_SUBMODULES) +@@ -371,6 +371,8 @@ if(NOT MANUAL_SUBMODULES) check_submodule(external/trezor-common) check_submodule(external/randomx) check_submodule(external/supercop) @@ -64,7 +68,7 @@ index 8fb03ba1f..63b8c5079 100644 endif() endif() -@@ -458,7 +460,7 @@ endif() +@@ -460,7 +462,7 @@ endif() # elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*") # set(BSDI TRUE) @@ -118,16 +122,31 @@ index b016f2f48..f2f365b1b 100644 + } diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index 5b7f69a56..1b9761d70 100644 +index f9ed6a69a..8fcf792d7 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt -@@ -70,3 +70,5 @@ add_subdirectory(db_drivers) +@@ -69,5 +69,7 @@ endif() + add_subdirectory(db_drivers) add_subdirectory(easylogging++) add_subdirectory(qrcodegen) - add_subdirectory(randomx EXCLUDE_FROM_ALL) +add_subdirectory(polyseed EXCLUDE_FROM_ALL) +add_subdirectory(utf8proc EXCLUDE_FROM_ALL) -\ No newline at end of file + add_subdirectory(bc-ur) + add_subdirectory(randomx EXCLUDE_FROM_ALL) +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..3de4596fb +--- /dev/null ++++ b/external/utf8proc +@@ -0,0 +1 @@ ++Subproject commit 3de4596fbe28956855df2ecb3c11c0bbc3535838 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3335d3c21..06b708cf0 100644 --- a/src/CMakeLists.txt @@ -153,7 +172,7 @@ index 1414be1b2..414936a05 100644 ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SERIALIZATION_LIBRARY} diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp -index 2ac455fda..4931c3740 100644 +index 4e87d4477..2d556f285 100644 --- a/src/cryptonote_basic/account.cpp +++ b/src/cryptonote_basic/account.cpp @@ -87,12 +87,16 @@ DISABLE_VS_WARNINGS(4244 4345) @@ -182,8 +201,8 @@ index 2ac455fda..4931c3740 100644 + m_keys.m_passphrase.wipe(); } //----------------------------------------------------------------- - crypto::secret_key account_base::generate(const crypto::secret_key& recovery_key, bool recover, bool two_random) -@@ -244,6 +250,21 @@ DISABLE_VS_WARNINGS(4244 4345) + void account_base::set_spend_key(const crypto::secret_key& spend_secret_key) +@@ -255,6 +261,21 @@ DISABLE_VS_WARNINGS(4244 4345) create_from_keys(address, fake, viewkey); } //----------------------------------------------------------------- @@ -206,7 +225,7 @@ index 2ac455fda..4931c3740 100644 { m_keys.m_account_address.m_spend_public_key = spend_public_key; diff --git a/src/cryptonote_basic/account.h b/src/cryptonote_basic/account.h -index 2ee9545d4..0099ebfe7 100644 +index 93d1d28f0..1f76febce 100644 --- a/src/cryptonote_basic/account.h +++ b/src/cryptonote_basic/account.h @@ -33,6 +33,7 @@ @@ -244,7 +263,7 @@ index 2ee9545d4..0099ebfe7 100644 const account_keys& get_keys() const; std::string get_public_address_str(network_type nettype) const; diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h -index 61146a114..8e1a07110 100644 +index f9e6a6cb9..3af3a63a1 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -207,6 +207,8 @@ @@ -795,10 +814,10 @@ 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 fc4f89128..d96ea97ea 100644 +index ec79482ac..e74fa0884 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 +@@ -728,6 +728,28 @@ bool WalletImpl::recoverFromDevice(const std::string &path, const std::string &p return true; } @@ -827,35 +846,35 @@ index fc4f89128..d96ea97ea 100644 Wallet::Device WalletImpl::getDeviceType() const { return static_cast(m_wallet->get_device_type()); -@@ -798,6 +820,55 @@ std::string WalletImpl::seed(const std::string& seed_offset) const - return std::string(seed.data(), seed.size()); // TODO +@@ -845,6 +867,54 @@ std::string WalletImpl::seed(const std::string& seed_offset) const + } } +bool WalletImpl::getPolyseed(std::string &seed_words, std::string &passphrase) const +{ -+ epee::wipeable_string seed_words_epee(seed_words.c_str(), seed_words.size()); -+ epee::wipeable_string passphrase_epee(passphrase.c_str(), passphrase.size()); -+ clearStatus(); ++ epee::wipeable_string seed_words_epee(seed_words.c_str(), seed_words.size()); ++ epee::wipeable_string passphrase_epee(passphrase.c_str(), passphrase.size()); ++ clearStatus(); + -+ if (!m_wallet) { -+ return false; -+ } ++ if (!m_wallet) { ++ return false; ++ } + -+ bool result = m_wallet->get_polyseed(seed_words_epee, passphrase_epee); ++ 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()); ++ seed_words.assign(seed_words_epee.data(), seed_words_epee.size()); ++ passphrase.assign(passphrase_epee.data(), passphrase_epee.size()); + -+ return result; ++ return result; +} + +std::vector> Wallet::getPolyseedLanguages() -+{ ++ { + std::vector> languages; + + auto langs = polyseed::get_langs(); + for (const auto &lang : langs) { -+ languages.emplace_back(std::pair(lang.name_en(), lang.name())); ++ languages.emplace_back(std::pair(lang.name_en(), lang.name())); + } + + return languages; @@ -863,28 +882,27 @@ index fc4f89128..d96ea97ea 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()); ++ epee::wipeable_string seed_words_epee(seed_words.c_str(), seed_words.size()); + -+ try { -+ polyseed::data polyseed(POLYSEED_COIN); -+ polyseed.create(0); -+ polyseed.encode(polyseed::get_lang_by_name(language), seed_words_epee); ++ try { ++ polyseed::data polyseed(POLYSEED_COIN); ++ polyseed.create(0); ++ polyseed.encode(polyseed::get_lang_by_name(language), seed_words_epee); + -+ seed_words.assign(seed_words_epee.data(), seed_words_epee.size()); -+ } -+ catch (const std::exception &e) { -+ err = e.what(); -+ return false; -+ } ++ seed_words.assign(seed_words_epee.data(), seed_words_epee.size()); ++ } ++ catch (const std::exception &e) { ++ err = e.what(); ++ return false; ++ } + -+ return true; ++ return true; +} -+ std::string WalletImpl::getSeedLanguage() const { return m_wallet->get_seed_language(); diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index ec2d7e9b3..787215ab3 100644 +index 4e9c21ecb..32e12284b 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -79,9 +79,19 @@ public: @@ -908,10 +926,10 @@ index ec2d7e9b3..787215ab3 100644 void setSeedLanguage(const std::string &arg) override; // void setListener(Listener *) {} diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index 71991df0d..9ea753083 100644 +index 53ec4abfc..be1c3704e 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h -@@ -700,6 +700,10 @@ struct Wallet +@@ -709,6 +709,10 @@ struct Wallet static void warning(const std::string &category, const std::string &str); static void error(const std::string &category, const std::string &str); @@ -922,7 +940,7 @@ index 71991df0d..9ea753083 100644 /** * @brief StartRefresh - Start/resume refresh thread (refresh every 10 seconds) */ -@@ -1256,6 +1260,27 @@ struct WalletManager +@@ -1320,6 +1324,27 @@ struct WalletManager uint64_t kdf_rounds = 1, WalletListener * listener = nullptr) = 0; @@ -992,7 +1010,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 64f486e71..9e95f44d6 100644 +index 4f58d7aea..1b3a66279 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -92,6 +92,7 @@ using namespace epee; @@ -1003,7 +1021,7 @@ index 64f486e71..9e95f44d6 100644 extern "C" { -@@ -1260,7 +1261,8 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std +@@ -1278,7 +1279,8 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std m_enable_multisig(false), m_pool_info_query_time(0), m_has_ever_refreshed_from_node(false), @@ -1013,61 +1031,56 @@ index 64f486e71..9e95f44d6 100644 { set_rpc_client_secret_key(rct::rct2sk(rct::skGen())); } -@@ -1438,10 +1440,25 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab - key = cryptonote::encrypt_key(key, passphrase); - if (!crypto::ElectrumWords::bytes_to_words(key, electrum_words, seed_language)) - { -- std::cout << "Failed to create seed from key for language: " << seed_language << std::endl; -+ std::cout << "Failed to create seed from key for language: " << seed_language << ", falling back to English." << std::endl; -+ crypto::ElectrumWords::bytes_to_words(key, electrum_words, "English"); -+ } +@@ -1474,6 +1476,20 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab + return true; + } + //---------------------------------------------------------------------------------------------------- + -+ return true; -+} -+//---------------------------------------------------------------------------------------------------- +bool wallet2::get_polyseed(epee::wipeable_string& polyseed, epee::wipeable_string& passphrase) const +{ + if (!m_polyseed) { - return false; - } - ++ return false; ++ } ++ + polyseed::data data(POLYSEED_COIN); + data.load(get_account().get_keys().m_polyseed); + data.encode(polyseed::get_lang_by_name(seed_language), polyseed); -+ + passphrase = get_account().get_keys().m_passphrase; -+ - return true; - } - //---------------------------------------------------------------------------------------------------- -@@ -4630,6 +4647,9 @@ boost::optional wallet2::get_keys_file_data(const epee: ++ return true; ++} ++//---------------------------------------------------------------------------------------------------- + bool wallet2::get_multisig_seed(epee::wipeable_string& seed, const epee::wipeable_string &passphrase) const + { + bool ready; +@@ -4790,6 +4806,9 @@ boost::optional wallet2::get_keys_file_data(const crypt value2.SetInt(m_enable_multisig ? 1 : 0); json.AddMember("enable_multisig", value2, json.GetAllocator()); + value2.SetInt(m_polyseed ? 1 : 0); + json.AddMember("polyseed", value2, json.GetAllocator()); + - // Serialize the JSON object - rapidjson::StringBuffer buffer; - rapidjson::Writer writer(buffer); -@@ -4777,6 +4797,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st - m_credits_target = 0; + if (m_background_sync_type == BackgroundSyncCustomPassword && !background_keys_file && m_custom_background_key) + { + value.SetString(reinterpret_cast(m_custom_background_key.get().data()), m_custom_background_key.get().size()); +@@ -5029,6 +5048,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_custom_background_key = boost::none; + m_polyseed = false; } else if(json.IsObject()) { -@@ -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; +@@ -5269,6 +5289,9 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st + GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, background_sync_type, BackgroundSyncType, Int, false, BackgroundSyncOff); + m_background_sync_type = field_background_sync_type; + + GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, polyseed, int, Int, false, false); + m_polyseed = field_polyseed; - } - else - { -@@ -5285,6 +5308,48 @@ void wallet2::init_type(hw::device::device_type device_type) ++ + // Load encryption key used to encrypt background cache + crypto::chacha_key custom_background_key; + m_custom_background_key = boost::none; +@@ -5588,6 +5611,48 @@ void wallet2::init_type(hw::device::device_type device_type) m_key_device_type = device_type; } @@ -1116,7 +1129,7 @@ index 64f486e71..9e95f44d6 100644 /*! * \brief Generates a wallet or restores one. Assumes the multisig setup * has already completed for the provided multisig info. -@@ -5412,7 +5477,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip +@@ -5715,7 +5780,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip return retval; } @@ -1125,7 +1138,7 @@ index 64f486e71..9e95f44d6 100644 { // -1 month for fluctuations in block time and machine date/time setup. // avg seconds per block -@@ -5436,7 +5501,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip +@@ -5739,7 +5804,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. @@ -1134,7 +1147,7 @@ index 64f486e71..9e95f44d6 100644 uint64_t target_height = get_daemon_blockchain_target_height(err); if (err.empty()) { if (target_height < height) -@@ -13133,7 +13198,7 @@ uint64_t wallet2::get_daemon_blockchain_target_height(string &err) +@@ -13636,7 +13701,7 @@ uint64_t wallet2::get_daemon_blockchain_target_height(string &err) return target_height; } @@ -1143,7 +1156,7 @@ index 64f486e71..9e95f44d6 100644 { // time of v2 fork const time_t fork_time = m_nettype == TESTNET ? 1448285909 : m_nettype == STAGENET ? 1520937818 : 1458748658; -@@ -13142,7 +13207,7 @@ uint64_t wallet2::get_approximate_blockchain_height() const +@@ -13645,7 +13710,7 @@ uint64_t wallet2::get_approximate_blockchain_height() const // avg seconds per block const int seconds_per_block = DIFFICULTY_TARGET_V2; // Calculated blockchain height @@ -1152,7 +1165,7 @@ index 64f486e71..9e95f44d6 100644 // 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 : m_nettype == STAGENET ? 60000 : 30000; if ((m_nettype == TESTNET || m_nettype == STAGENET) && approx_blockchain_height > approximate_rolled_back_blocks) -@@ -14860,15 +14925,6 @@ bool wallet2::parse_uri(const std::string &uri, std::string &address, std::strin +@@ -15784,15 +15849,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) { @@ -1168,7 +1181,7 @@ index 64f486e71..9e95f44d6 100644 std::tm date = { 0, 0, 0, 0, 0, 0, 0, 0 }; date.tm_year = year - 1900; date.tm_mon = month - 1; -@@ -14877,7 +14933,23 @@ uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, ui +@@ -15801,7 +15857,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"); } @@ -1193,7 +1206,7 @@ index 64f486e71..9e95f44d6 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 c38d77675..91ec72e0f 100644 +index 1d7e430b9..91cf2a376 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -72,6 +72,7 @@ @@ -1204,7 +1217,7 @@ index c38d77675..91ec72e0f 100644 #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2" -@@ -854,6 +855,20 @@ private: +@@ -921,6 +922,20 @@ private: void generate(const std::string& wallet_, const epee::wipeable_string& password, const epee::wipeable_string& multisig_data, bool create_address_file = false); @@ -1225,7 +1238,7 @@ index c38d77675..91ec72e0f 100644 /*! * \brief Generates a wallet or restores one. * \param wallet_ Name of wallet file -@@ -1018,6 +1033,15 @@ private: +@@ -1088,6 +1103,15 @@ private: bool is_deterministic() const; bool get_seed(epee::wipeable_string& electrum_words, const epee::wipeable_string &passphrase = epee::wipeable_string()) const; @@ -1241,7 +1254,7 @@ index c38d77675..91ec72e0f 100644 /*! * \brief Checks if light wallet. A light wallet sends view key to a server where the blockchain is scanned. */ -@@ -1466,8 +1490,8 @@ private: +@@ -1555,8 +1579,8 @@ private: /*! * \brief Calculates the approximate blockchain height from current date/time. */ @@ -1252,7 +1265,7 @@ index c38d77675..91ec72e0f 100644 std::vector select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool allow_rct); std::vector select_available_outputs(const std::function &f); std::vector select_available_unmixable_outputs(); -@@ -1559,6 +1583,7 @@ private: +@@ -1650,6 +1674,7 @@ private: bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector &unknown_parameters, std::string &error); uint64_t get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day); // 1<=month<=12, 1<=day<=31 @@ -1260,7 +1273,7 @@ index c38d77675..91ec72e0f 100644 bool is_synced(); -@@ -1874,6 +1899,7 @@ private: +@@ -1995,6 +2020,7 @@ private: std::string seed_language; /*!< Language of the mnemonics (seed). */ bool is_old_file_format; /*!< Whether the wallet file is of an old file format */ bool m_watch_only; /*!< no spend key */ @@ -1269,5 +1282,5 @@ index c38d77675..91ec72e0f 100644 uint32_t m_multisig_threshold; std::vector m_multisig_signers; -- -2.39.2 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0004-coin-control.patch b/patches/monero/0009-coin-control.patch similarity index 82% rename from patches/monero/0004-coin-control.patch rename to patches/monero/0009-coin-control.patch index 1700a617..bbdd3e00 100644 --- a/patches/monero/0004-coin-control.patch +++ b/patches/monero/0009-coin-control.patch @@ -1,25 +1,39 @@ -From d6d52b6156f1e83a69474a871043d414e4488f62 Mon Sep 17 00:00:00 2001 +From 91e4dbbd5dc70012a6c0d87f3932e4c84428bf2f Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 12 Mar 2024 11:07:57 +0100 -Subject: [PATCH 04/16] coin control +Subject: [PATCH 09/11] coin control --- - src/wallet/api/CMakeLists.txt | 8 +- - src/wallet/api/coins.cpp | 185 ++++++++++++++++++++++++++++++++++ - 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 | 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, 555 insertions(+), 16 deletions(-) + src/simplewallet/simplewallet.cpp | 2 +- + src/wallet/api/CMakeLists.txt | 8 +- + src/wallet/api/coins.cpp | 186 ++++++++++++++++++++++++++++++ + 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 | 64 +++++++++- + src/wallet/api/wallet.h | 10 +- + src/wallet/api/wallet2_api.h | 52 ++++++++- + src/wallet/wallet2.cpp | 46 +++++++- + src/wallet/wallet2.h | 11 +- + 11 files changed, 593 insertions(+), 19 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 create mode 100644 src/wallet/api/coins_info.h +diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp +index 2c51337ef..645bd37e2 100644 +--- a/src/simplewallet/simplewallet.cpp ++++ b/src/simplewallet/simplewallet.cpp +@@ -6930,7 +6930,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); + + if (ptx_vector.empty()) + { diff --git a/src/wallet/api/CMakeLists.txt b/src/wallet/api/CMakeLists.txt index af7948d8a..bb740e2ac 100644 --- a/src/wallet/api/CMakeLists.txt @@ -48,10 +62,10 @@ index af7948d8a..bb740e2ac 100644 ${wallet_api_private_headers}) diff --git a/src/wallet/api/coins.cpp b/src/wallet/api/coins.cpp new file mode 100644 -index 000000000..2321c638d +index 000000000..ef12141cf --- /dev/null +++ b/src/wallet/api/coins.cpp -@@ -0,0 +1,185 @@ +@@ -0,0 +1,186 @@ +#include "coins.h" +#include "coins_info.h" +#include "wallet.h" @@ -168,6 +182,7 @@ index 000000000..2321c638d +{ + try + { ++ LOG_ERROR("Freezing coin: " << index); + m_wallet->m_wallet->freeze(index); + refresh(); + } @@ -489,7 +504,7 @@ index 000000000..c43e45abd + +#endif //FEATHER_COINS_INFO_H diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 837b98e6b..2106dbd07 100644 +index e74fa0884..66c1e45a6 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -35,6 +35,7 @@ @@ -500,15 +515,15 @@ index 837b98e6b..2106dbd07 100644 #include "subaddress_account.h" #include "common_defines.h" #include "common/util.h" -@@ -469,6 +470,7 @@ WalletImpl::WalletImpl(NetworkType nettype, uint64_t kdf_rounds) - m_refreshEnabled = false; +@@ -473,6 +474,7 @@ WalletImpl::WalletImpl(NetworkType nettype, uint64_t kdf_rounds) + m_wallet->set_refresh_enabled(false); m_addressBook.reset(new AddressBookImpl(this)); m_subaddress.reset(new SubaddressImpl(this)); + m_coins.reset(new CoinsImpl(this)); m_subaddressAccount.reset(new SubaddressAccountImpl(this)); -@@ -1752,7 +1754,7 @@ PendingTransaction* WalletImpl::restoreMultisigTransaction(const string& signDat +@@ -2046,7 +2048,7 @@ PendingTransaction* WalletImpl::restoreMultisigTransaction(const string& signDat // - unconfirmed_transfer_details; // - confirmed_transfer_details) @@ -517,27 +532,89 @@ index 837b98e6b..2106dbd07 100644 { clearStatus(); -@@ -1821,6 +1823,19 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectornettype(), dst_addr[i])) { + // TODO: copy-paste 'if treating as an address fails, try as url' from simplewallet.cpp:1982 +@@ -2105,6 +2108,7 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectorunlocked_balance(subaddr_account, true); ++ // if (maxAllowedSpend < amountSum) { ++ // error = true; ++ // setStatusError(tr("Amount you are trying to spend is larger than unlocked amount")); ++ // break; ++ // } + std::vector preferred_input_list; + if (!preferred_inputs.empty()) { ++ LOG_ERROR("empty"); ++ + for (const auto &public_key : preferred_inputs) { + crypto::key_image keyImage; + bool r = epee::string_tools::hex_to_pod(public_key, keyImage); -+ if (!r) { ++ if (!r) { + error = true; + setStatusError(tr("failed to parse key image")); + break; + } ++ if (m_wallet->frozen(keyImage)) { ++ error = true; ++ setStatusError(tr("refusing to spend frozen coin")); ++ break; ++ } ++ + preferred_input_list.push_back(keyImage); + } ++ } else { ++ LOG_ERROR("not empty"); ++ ++ boost::shared_lock transfers_lock(m_wallet->m_transfers_mutex); ++ for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i) { ++ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i); ++ LOG_ERROR("COIN: " << i << ": " << td.amount() << "; "<frozen(td)); ++ if (td.m_spent) continue; ++ LOG_ERROR("is frozen"); ++ if (!td.m_frozen) { ++ LOG_ERROR("isn't:"); ++ LOG_ERROR("hash: " << td.m_key_image << "; " << td.amount()); ++ preferred_input_list.push_back(td.m_key_image); ++ } ++ } ++ } ++ for (const auto &de : preferred_input_list) { ++ LOG_ERROR("preferred input: " << de); + } if (error) { break; } -@@ -1920,10 +1935,10 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectorm_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, + 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, + adjusted_priority, +- extra, subaddr_account, subaddr_indices); ++ extra, subaddr_account, subaddr_indices, preferred_input_list); + } + pendingTxPostProcess(transaction); + +@@ -2214,10 +2263,10 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector amount, uint32_t mixin_count, @@ -550,7 +627,7 @@ index 837b98e6b..2106dbd07 100644 } PendingTransaction *WalletImpl::createSweepUnmixableTransaction() -@@ -2048,6 +2063,11 @@ AddressBook *WalletImpl::addressBook() +@@ -2342,6 +2391,11 @@ AddressBook *WalletImpl::addressBook() return m_addressBook.get(); } @@ -563,7 +640,7 @@ index 837b98e6b..2106dbd07 100644 { return m_subaddress.get(); diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index 05d065c5c..4a16ca028 100644 +index 32e12284b..a82f270e4 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -46,6 +46,7 @@ class PendingTransactionImpl; @@ -590,8 +667,8 @@ index 05d065c5c..4a16ca028 100644 + const std::set &preferred_inputs = {}) override; virtual PendingTransaction * createSweepUnmixableTransaction() override; bool submitTransaction(const std::string &fileName) override; - virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override; -@@ -195,6 +198,7 @@ public: + bool submitTransactionUR(const std::string &input) override; +@@ -201,6 +204,7 @@ public: PendingTransaction::Priority priority) const override; virtual TransactionHistory * history() override; virtual AddressBook * addressBook() override; @@ -599,7 +676,7 @@ index 05d065c5c..4a16ca028 100644 virtual Subaddress * subaddress() override; virtual SubaddressAccount * subaddressAccount() override; virtual void setListener(WalletListener * l) override; -@@ -266,6 +270,7 @@ private: +@@ -272,6 +276,7 @@ private: friend class TransactionHistoryImpl; friend struct Wallet2CallbackImpl; friend class AddressBookImpl; @@ -607,7 +684,7 @@ index 05d065c5c..4a16ca028 100644 friend class SubaddressImpl; friend class SubaddressAccountImpl; -@@ -282,6 +287,7 @@ private: +@@ -288,6 +293,7 @@ private: std::unique_ptr m_wallet2Callback; std::unique_ptr m_addressBook; std::unique_ptr m_subaddress; @@ -616,10 +693,10 @@ index 05d065c5c..4a16ca028 100644 // multi-threaded refresh stuff diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index 4edaefefd..8a5c4135e 100644 +index be1c3704e..013b5bcba 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h -@@ -261,6 +261,51 @@ struct AddressBook +@@ -263,6 +263,51 @@ struct AddressBook virtual int lookupPaymentID(const std::string &payment_id) const = 0; }; @@ -671,7 +748,7 @@ index 4edaefefd..8a5c4135e 100644 struct SubaddressRow { public: SubaddressRow(std::size_t _rowId, const std::string &_address, const std::string &_label): -@@ -854,7 +899,8 @@ struct Wallet +@@ -856,7 +901,8 @@ struct Wallet optional> amount, uint32_t mixin_count, PendingTransaction::Priority = PendingTransaction::Priority_Low, uint32_t subaddr_account = 0, @@ -681,7 +758,7 @@ index 4edaefefd..8a5c4135e 100644 /*! * \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored -@@ -873,7 +919,8 @@ struct Wallet +@@ -875,7 +921,8 @@ struct Wallet optional amount, uint32_t mixin_count, PendingTransaction::Priority = PendingTransaction::Priority_Low, uint32_t subaddr_account = 0, @@ -691,7 +768,7 @@ index 4edaefefd..8a5c4135e 100644 /*! * \brief createSweepUnmixableTransaction creates transaction with unmixable outputs. -@@ -987,6 +1034,7 @@ struct Wallet +@@ -994,6 +1041,7 @@ struct Wallet virtual TransactionHistory * history() = 0; virtual AddressBook * addressBook() = 0; @@ -700,10 +777,10 @@ 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 41cf1fd41..61601f70c 100644 +index 1b3a66279..007ec384c 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp -@@ -2083,12 +2083,21 @@ bool wallet2::frozen(const multisig_tx_set& txs) const +@@ -2094,12 +2094,21 @@ bool wallet2::frozen(const multisig_tx_set& txs) const return false; } @@ -725,7 +802,7 @@ index 41cf1fd41..61601f70c 100644 void wallet2::thaw(const crypto::key_image &ki) { thaw(get_transfer_details(ki)); -@@ -2099,6 +2108,18 @@ bool wallet2::frozen(const crypto::key_image &ki) const +@@ -2110,6 +2119,18 @@ bool wallet2::frozen(const crypto::key_image &ki) const return frozen(get_transfer_details(ki)); } //---------------------------------------------------------------------------------------------------- @@ -744,7 +821,7 @@ index 41cf1fd41..61601f70c 100644 size_t wallet2::get_transfer_details(const crypto::key_image &ki) const { for (size_t idx = 0; idx < m_transfers.size(); ++idx) -@@ -2510,6 +2531,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote +@@ -2521,6 +2542,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote uint64_t amount = tx.vout[o].amount ? tx.vout[o].amount : tx_scan_info[o].amount; if (!pool) { @@ -752,7 +829,7 @@ index 41cf1fd41..61601f70c 100644 m_transfers.push_back(transfer_details{}); transfer_details& td = m_transfers.back(); td.m_block_height = height; -@@ -2613,6 +2635,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote +@@ -2624,6 +2646,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote uint64_t extra_amount = amount - burnt; if (!pool) { @@ -760,7 +837,7 @@ index 41cf1fd41..61601f70c 100644 transfer_details &td = m_transfers[kit->second]; td.m_block_height = height; td.m_internal_output_index = o; -@@ -10487,7 +10510,7 @@ void wallet2::transfer_selected_rct(std::vector picks; float current_output_relatdness = 1.0f; -@@ -10498,6 +10521,9 @@ std::vector wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui +@@ -10512,6 +10535,9 @@ std::vector wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui for (size_t i = 0; i < m_transfers.size(); ++i) { const transfer_details& td = m_transfers[i]; @@ -779,7 +856,7 @@ index 41cf1fd41..61601f70c 100644 if (!is_spent(td, false) && !td.m_frozen && td.is_rct() && td.amount() >= needed_money && is_transfer_unlocked(td) && td.m_subaddr_index.major == subaddr_account && subaddr_indices.count(td.m_subaddr_index.minor) == 1) { if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below) -@@ -10518,6 +10544,9 @@ std::vector wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui +@@ -10532,6 +10558,9 @@ std::vector wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui for (size_t i = 0; i < m_transfers.size(); ++i) { const transfer_details& td = m_transfers[i]; @@ -789,7 +866,7 @@ index 41cf1fd41..61601f70c 100644 if (!is_spent(td, false) && !td.m_frozen && !td.m_key_image_partial && td.is_rct() && is_transfer_unlocked(td) && td.m_subaddr_index.major == subaddr_account && subaddr_indices.count(td.m_subaddr_index.minor) == 1) { if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below) -@@ -10529,6 +10558,9 @@ std::vector wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui +@@ -10543,6 +10572,9 @@ std::vector wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui for (size_t j = i + 1; j < m_transfers.size(); ++j) { const transfer_details& td2 = m_transfers[j]; @@ -799,7 +876,7 @@ index 41cf1fd41..61601f70c 100644 if (td2.amount() > m_ignore_outputs_above || td2.amount() < m_ignore_outputs_below) { MDEBUG("Ignoring output " << j << " of amount " << print_money(td2.amount()) << " which is outside prescribed range [" << print_money(m_ignore_outputs_below) << ", " << print_money(m_ignore_outputs_above) << "]"); -@@ -11101,7 +11133,7 @@ bool wallet2::light_wallet_key_image_is_ours(const crypto::key_image& key_image, +@@ -11115,7 +11147,7 @@ bool wallet2::light_wallet_key_image_is_ours(const crypto::key_image& key_image, // 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. @@ -808,7 +885,7 @@ index 41cf1fd41..61601f70c 100644 { //ensure device is let in NONE mode in any case hw::device &hwdev = m_account.get_device(); -@@ -11309,6 +11341,9 @@ std::vector wallet2::create_transactions_2(std::vector wallet2::create_transactions_2(std::vector wallet2::create_transactions_2(std::vector wallet2::create_transactions_2(std::vector &ptx_vector, c +@@ -11893,7 +11928,7 @@ bool wallet2::sanity_check(const std::vector &ptx_vector, c return true; } @@ -836,7 +913,7 @@ index 41cf1fd41..61601f70c 100644 { std::vector unused_transfers_indices; std::vector unused_dust_indices; -@@ -11908,6 +11943,9 @@ std::vector wallet2::create_transactions_all(uint64_t below +@@ -11922,6 +11957,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]; @@ -847,21 +924,21 @@ index 41cf1fd41..61601f70c 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 b9aa7a00d..67ed81383 100644 +index 91cf2a376..bc16d528c 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h -@@ -1207,8 +1207,8 @@ private: +@@ -1209,8 +1209,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, 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_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: +@@ -1562,6 +1562,7 @@ private: uint64_t get_num_rct_outputs(); size_t get_num_transfer_details() const { return m_transfers.size(); } const transfer_details &get_transfer_details(size_t idx) const; @@ -869,7 +946,7 @@ index b9aa7a00d..67ed81383 100644 uint8_t get_current_hard_fork(); void get_hard_fork_info(uint8_t version, uint64_t &earliest_height); -@@ -1789,7 +1790,9 @@ private: +@@ -1793,7 +1794,9 @@ private: void freeze(size_t idx); void thaw(size_t idx); bool frozen(size_t idx) const; @@ -879,7 +956,7 @@ index b9aa7a00d..67ed81383 100644 void thaw(const crypto::key_image &ki); bool frozen(const crypto::key_image &ki) const; bool frozen(const transfer_details &td) const; -@@ -1830,6 +1833,8 @@ private: +@@ -1834,6 +1837,8 @@ private: static std::string get_default_daemon_address() { CRITICAL_REGION_LOCAL(default_daemon_address_lock); return default_daemon_address; } @@ -888,7 +965,7 @@ index b9aa7a00d..67ed81383 100644 private: /*! * \brief Stores wallet information to wallet file. -@@ -1901,7 +1906,7 @@ private: +@@ -1905,7 +1910,7 @@ private: std::vector get_unspent_amounts_vector(bool strict); uint64_t get_dynamic_base_fee_estimate(); float get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const; @@ -898,5 +975,5 @@ index b9aa7a00d..67ed81383 100644 void set_unspent(size_t idx); bool is_spent(const transfer_details &td, bool strict = true) const; -- -2.39.2 +2.39.5 (Apple Git-154) 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 e3176271..ac7d366f 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 3cc8b1f822f642b574fe38ff27627b362002eab7 Mon Sep 17 00:00:00 2001 +From c596464532d07615bdbcaa4ba9e719179e167944 Mon Sep 17 00:00:00 2001 From: M Date: Fri, 21 Apr 2023 15:43:47 -0400 -Subject: [PATCH 10/16] Add hex encoding and tx key getter for +Subject: [PATCH 10/11] Add hex encoding and tx key getter for PendingTransction in wallet api. --- @@ -11,10 +11,10 @@ Subject: [PATCH 10/16] Add hex encoding and tx key getter for 3 files changed, 20 insertions(+) diff --git a/src/wallet/api/pending_transaction.cpp b/src/wallet/api/pending_transaction.cpp -index 70a702796..be20b478c 100644 +index 9c3c26ee5..1f714d229 100644 --- a/src/wallet/api/pending_transaction.cpp +++ b/src/wallet/api/pending_transaction.cpp -@@ -78,6 +78,22 @@ std::vector PendingTransactionImpl::txid() const +@@ -80,6 +80,22 @@ std::vector PendingTransactionImpl::txid() const return txid; } @@ -38,10 +38,10 @@ index 70a702796..be20b478c 100644 { diff --git a/src/wallet/api/pending_transaction.h b/src/wallet/api/pending_transaction.h -index 0a9779c07..2fbaa83d9 100644 +index 403bfe281..0cc6c58e9 100644 --- a/src/wallet/api/pending_transaction.h +++ b/src/wallet/api/pending_transaction.h -@@ -58,6 +58,8 @@ public: +@@ -59,6 +59,8 @@ public: std::string multisigSignData() override; void signMultisigTx() override; std::vector signersKeys() const override; @@ -51,10 +51,10 @@ index 0a9779c07..2fbaa83d9 100644 private: friend class WalletImpl; diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index a585c8212..1c3a11c39 100644 +index 013b5bcba..f421fdc05 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h -@@ -126,6 +126,8 @@ struct PendingTransaction +@@ -127,6 +127,8 @@ struct PendingTransaction * @return vector of base58-encoded signers' public keys */ virtual std::vector signersKeys() const = 0; @@ -64,5 +64,5 @@ index a585c8212..1c3a11c39 100644 /** -- -2.39.2 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0009-Add-recoverDeterministicWalletFromSpendKey.patch b/patches/monero/0011-Add-recoverDeterministicWalletFromSpendKey.patch similarity index 95% rename from patches/monero/0009-Add-recoverDeterministicWalletFromSpendKey.patch rename to patches/monero/0011-Add-recoverDeterministicWalletFromSpendKey.patch index 0ef99002..2b8a7120 100644 --- a/patches/monero/0009-Add-recoverDeterministicWalletFromSpendKey.patch +++ b/patches/monero/0011-Add-recoverDeterministicWalletFromSpendKey.patch @@ -1,7 +1,7 @@ -From ff4d7f9500e6aca57a78d94599a70b7823ea6ecd Mon Sep 17 00:00:00 2001 +From 9f2485a34746bfc4dda29a82153a89103f4c5340 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Wed, 11 Oct 2023 16:47:59 +0200 -Subject: [PATCH 09/16] Add recoverDeterministicWalletFromSpendKey +Subject: [PATCH 11/11] Add recoverDeterministicWalletFromSpendKey This function is used by Cake Wallet to enable polyseed (dart implementation) support. @@ -19,10 +19,10 @@ 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 2106dbd07..ec4ae51ff 100644 +index 66c1e45a6..cb09db8b2 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 +@@ -824,6 +824,35 @@ bool WalletImpl::recover(const std::string &path, const std::string &password, c return status() == Status_Ok; } @@ -59,7 +59,7 @@ index 2106dbd07..ec4ae51ff 100644 { diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index 4a16ca028..d0f443abc 100644 +index a82f270e4..9e1fbb40b 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -77,6 +77,10 @@ public: @@ -74,10 +74,10 @@ index 4a16ca028..d0f443abc 100644 const std::string &password, const std::string &device_name); diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index 8a5c4135e..a585c8212 100644 +index f421fdc05..c8d6bb179 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h -@@ -1302,6 +1302,25 @@ struct WalletManager +@@ -1323,6 +1323,25 @@ struct WalletManager return createWalletFromKeys(path, password, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString); } @@ -149,5 +149,5 @@ index 28fcd36c9..be3ff8184 100644 const std::string &password, NetworkType nettype, -- -2.39.2 +2.39.5 (Apple Git-154) diff --git a/patches/monero/0014-rename-arm-armv7a.patch b/patches/monero/0014-rename-arm-armv7a.patch deleted file mode 100644 index 20e28224..00000000 --- a/patches/monero/0014-rename-arm-armv7a.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 2dfa0442a096f61fe16a5bc569a4d0ab9ddb7de5 Mon Sep 17 00:00:00 2001 -From: Czarek Nakamoto -Date: Wed, 12 Jun 2024 15:48:01 +0200 -Subject: [PATCH 14/16] rename arm -> armv7a - ---- - contrib/depends/hosts/android.mk | 2 +- - contrib/depends/packages/android_ndk.mk | 6 +++++- - contrib/depends/packages/openssl.mk | 2 +- - contrib/depends/toolchain.cmake.in | 8 ++++---- - 4 files changed, 11 insertions(+), 7 deletions(-) - -diff --git a/contrib/depends/hosts/android.mk b/contrib/depends/hosts/android.mk -index e1c99aef3..827103c36 100644 ---- a/contrib/depends/hosts/android.mk -+++ b/contrib/depends/hosts/android.mk -@@ -1,6 +1,6 @@ - ANDROID_API=21 - host_toolchain=nonexistent --ifeq ($(host_arch),arm) -+ifeq ($(host_arch),armv7a) - host_toolchain=armv7a-linux-androideabi${ANDROID_API}- - endif - ifeq ($(host_arch),x86_64) -diff --git a/contrib/depends/packages/android_ndk.mk b/contrib/depends/packages/android_ndk.mk -index 1ad250653..2c2914ec2 100644 ---- a/contrib/depends/packages/android_ndk.mk -+++ b/contrib/depends/packages/android_ndk.mk -@@ -7,7 +7,7 @@ $(package)_sha256_hash=eefeafe7ccf177de7cc57158da585e7af119bb7504a63604ad719e4b2 - $(package)_version_apiversion=21 - - define $(package)_set_vars --$(package)_config_opts_arm=--arch arm -+$(package)_config_opts_armv7a=--arch arm - $(package)_config_opts_aarch64=--arch arm64 - $(package)_config_opts_x86_64=--arch x86_64 - $(package)_config_opts_i686=--arch x86 -@@ -18,6 +18,8 @@ define $(package)_extract_cmds - unzip -q $($(1)_source_dir)/$($(package)_file_name) - endef - -+# arm-linux-androideabi-ar - openssl workaround -+ - define $(package)_stage_cmds - mkdir -p $(build_prefix) &&\ - echo $(build_prefix)/toolchain && \ -@@ -25,7 +27,9 @@ define $(package)_stage_cmds - --install-dir $(build_prefix)/toolchain --stl=libc++ $($(package)_config_opts) &&\ - mv $(build_prefix)/toolchain $($(package)_staging_dir)/$(host_prefix)/native && \ - cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ar $($(package)_staging_dir)/$(host_prefix)/native/bin/$(host)$($(package)_version_apiversion)-ar &&\ -+ cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ar $($(package)_staging_dir)/$(host_prefix)/native/bin/arm-linux-androideabi-ar &&\ - cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ranlib $($(package)_staging_dir)/$(host_prefix)/native/bin/$(host)$($(package)_version_apiversion)-ranlib &&\ -+ cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ranlib $($(package)_staging_dir)/$(host_prefix)/native/bin/arm-linux-androideabi-ranlib &&\ - cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ar $($(package)_staging_dir)/$(host_prefix)/native/bin/$(host)-ar &&\ - cp $($(package)_staging_dir)/$(host_prefix)/native/bin/llvm-ranlib $($(package)_staging_dir)/$(host_prefix)/native/bin/$(host)-ranlib - endef -diff --git a/contrib/depends/packages/openssl.mk b/contrib/depends/packages/openssl.mk -index a157762c7..2430f6495 100644 ---- a/contrib/depends/packages/openssl.mk -+++ b/contrib/depends/packages/openssl.mk -@@ -34,7 +34,7 @@ $(package)_config_opts_x86_64_linux=linux-x86_64 - $(package)_config_opts_i686_linux=linux-generic32 - $(package)_config_opts_arm_linux=linux-generic32 - $(package)_config_opts_aarch64_linux=linux-generic64 --$(package)_config_opts_arm_android=--static android-arm -+$(package)_config_opts_armv7a_android=--static android-arm - $(package)_config_opts_aarch64_android=--static android-arm64 - $(package)_config_opts_aarch64_darwin=darwin64-arm64-cc - $(package)_config_opts_riscv64_linux=linux-generic64 -diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in -index 96a95ceb8..48a6f947e 100644 ---- a/contrib/depends/toolchain.cmake.in -+++ b/contrib/depends/toolchain.cmake.in -@@ -100,13 +100,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - SET(LLVM_ENABLE_PIE OFF) - elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") - SET(ANDROID TRUE) -- if(ARCHITECTURE STREQUAL "arm") -+ if(ARCHITECTURE STREQUAL "armv7a") - SET(CMAKE_ANDROID_ARCH_ABI "armeabi-v7a") - SET(CMAKE_SYSTEM_PROCESSOR "armv7-a") - SET(CMAKE_ANDROID_ARM_MODE ON) -- SET(CMAKE_C_COMPILER_TARGET arm-linux-androideabi21) -- SET(CMAKE_CXX_COMPILER_TARGET arm-linux-androideabi21) -- SET(_CMAKE_TOOLCHAIN_PREFIX arm-linux-androideabi21-) -+ SET(CMAKE_C_COMPILER_TARGET armv7a-linux-androideabi21) -+ SET(CMAKE_CXX_COMPILER_TARGET armv7a-linux-androideabi21) -+ SET(_CMAKE_TOOLCHAIN_PREFIX armv7a-linux-androideabi21-) - elseif(ARCHITECTURE STREQUAL "aarch64") - SET(CMAKE_ANDROID_ARCH_ABI "arm64-v8a") - SET(CMAKE_SYSTEM_PROCESSOR "aarch64") --- -2.39.2 - diff --git a/patches/monero/0017-added-deps.patch b/patches/monero/0017-added-deps.patch deleted file mode 100644 index 4edacce6..00000000 --- a/patches/monero/0017-added-deps.patch +++ /dev/null @@ -1,29 +0,0 @@ -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 - diff --git a/patches/monero/0018-fix-coin-control-patch.patch b/patches/monero/0018-fix-coin-control-patch.patch deleted file mode 100644 index 001a1c08..00000000 --- a/patches/monero/0018-fix-coin-control-patch.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 3d99b4efb5a79d7c52d596c349de25d1ca34c264 Mon Sep 17 00:00:00 2001 -From: Czarek Nakamoto -Date: Fri, 27 Sep 2024 12:20:49 +0200 -Subject: [PATCH] fix coin control patch - ---- - src/wallet/api/wallet.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 3ead385ec..ec7d60ec0 100644 ---- a/src/wallet/api/wallet.cpp -+++ b/src/wallet/api/wallet.cpp -@@ -2174,11 +2174,11 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectorm_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, - 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, - adjusted_priority, -- extra, subaddr_account, subaddr_indices); -+ extra, subaddr_account, subaddr_indices, preferred_input_list); - } - pendingTxPostProcess(transaction); - --- -2.39.5 (Apple Git-154) - diff --git a/patches/monero/0019-fix-for-coin-control-patch.patch b/patches/monero/0019-fix-for-coin-control-patch.patch deleted file mode 100644 index b7ff7f99..00000000 --- a/patches/monero/0019-fix-for-coin-control-patch.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 8f93306ed526e0e573b33fc7dd40abbba7e7a00a Mon Sep 17 00:00:00 2001 -From: Czarek Nakamoto -Date: Tue, 15 Oct 2024 18:00:05 +0200 -Subject: [PATCH] fix for coin control patch - ---- - src/wallet/api/coins.cpp | 1 + - src/wallet/api/wallet.cpp | 36 +++++++++++++++++++++++++++++++++++- - 2 files changed, 36 insertions(+), 1 deletion(-) - -diff --git a/src/wallet/api/coins.cpp b/src/wallet/api/coins.cpp -index 2321c638d..ef12141cf 100644 ---- a/src/wallet/api/coins.cpp -+++ b/src/wallet/api/coins.cpp -@@ -114,6 +114,7 @@ void CoinsImpl::setFrozen(int index) - { - try - { -+ LOG_ERROR("Freezing coin: " << index); - m_wallet->m_wallet->freeze(index); - refresh(); - } -diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index ec7d60ec0..db127dae4 100644 ---- a/src/wallet/api/wallet.cpp -+++ b/src/wallet/api/wallet.cpp -@@ -2116,6 +2116,7 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectornettype(), dst_addr[i])) { - // TODO: copy-paste 'if treating as an address fails, try as url' from simplewallet.cpp:1982 -@@ -2137,6 +2138,7 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectorunlocked_balance(subaddr_account, true); -+ // if (maxAllowedSpend < amountSum) { -+ // error = true; -+ // setStatusError(tr("Amount you are trying to spend is larger than unlocked amount")); -+ // break; -+ // } - std::vector preferred_input_list; - if (!preferred_inputs.empty()) { -+ LOG_ERROR("empty"); -+ - for (const auto &public_key : preferred_inputs) { - crypto::key_image keyImage; - bool r = epee::string_tools::hex_to_pod(public_key, keyImage); -- if (!r) { -+ if (!r) { - error = true; - setStatusError(tr("failed to parse key image")); - break; - } -+ if (m_wallet->frozen(keyImage)) { -+ error = true; -+ setStatusError(tr("refusing to spend frozen coin")); -+ break; -+ } -+ - preferred_input_list.push_back(keyImage); - } -+ } else { -+ LOG_ERROR("not empty"); -+ -+ boost::shared_lock transfers_lock(m_wallet->m_transfers_mutex); -+ for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i) { -+ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i); -+ LOG_ERROR("COIN: " << i << ": " << td.amount() << "; "<frozen(td)); -+ if (td.m_spent) continue; -+ LOG_ERROR("is frozen"); -+ if (!td.m_frozen) { -+ LOG_ERROR("isn't:"); -+ LOG_ERROR("hash: " << td.m_key_image << "; " << td.amount()); -+ preferred_input_list.push_back(td.m_key_image); -+ } -+ } -+ } -+ for (const auto &de : preferred_input_list) { -+ LOG_ERROR("preferred input: " << de); - } - if (error) { - break; --- -2.39.5 (Apple Git-154) - diff --git a/patches/monero/README.md b/patches/monero/README.md deleted file mode 100644 index b8405159..00000000 --- a/patches/monero/README.md +++ /dev/null @@ -1,43 +0,0 @@ - -> 0001 to 0004 were created most likely by feather dev, anonero monero repository got nuked and now says that I made the changes, so I am unable to credit the original authors, http://git.anonero5wmhraxqsvzq2ncgptq6gq45qoto6fnkfwughfl4gbt44swad.onion/ANONERO/monero/commits/branch/v0.18.3.3-anonero - - -# 0001-polyseed - -Polyseed support for wallets [planned in long distant future as a part of walet3 - not getting upstream, no PR available]. - -Note, only English support is available due to issues with normalization libraries. - -> tobtoht: You may also want to reconsider supporting languages other than English: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#wordlists (this is about BIP39, but because unicode normalization is such a PITA it will become true for Polyseed wallets as well) - -Considering the fact that even Feather Wallet doesn't support non-english seeds, it makes sense to go that way. - -At least until (if ever) feather wallet supports multi-language polyseed seeds I don't think it is a good idea to support them, especially because of possible issues when targetting different platforms. - -# 0002-background-sync - -Sourced from: https://github.com/monero-project/monero/pull/8617, no changes except for merge conflicts. - -# 0003-airgap - -Cool functions for offline transactions - -# 0004-coin-control - -Coin control patch, I was able to trace it's orgins back to wownero/monerujo. - -# 0005-fix-build - -Fix cross compilation for linux - -# 0006-macos-build-fix - -Fixes cross compilation for MacOS targets - -# 0007-fix-make-debug-test-target - -I had some debugging to do, I don't remember actually why I decided to run the tests, but since it is a fix I've decided to leave it in here just in case. - -# 0008-fix-missing-___clear_cache-when-targetting-iOS - -https://github.com/tevador/RandomX/pull/294 \ No newline at end of file