From 65950f46f40561f594114064009670d96a47301c Mon Sep 17 00:00:00 2001 From: cyan Date: Wed, 11 Dec 2024 12:21:44 -0500 Subject: Fix coin control error message (#94) * Fix coin control error message * fix string format --- ...0021-fix-error-messages-with-coin-control.patch | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 patches/monero/0021-fix-error-messages-with-coin-control.patch (limited to 'patches') diff --git a/patches/monero/0021-fix-error-messages-with-coin-control.patch b/patches/monero/0021-fix-error-messages-with-coin-control.patch new file mode 100644 index 0000000..b4e3625 --- /dev/null +++ b/patches/monero/0021-fix-error-messages-with-coin-control.patch @@ -0,0 +1,53 @@ +From 6259ee6acea965c2bc0bc2e4a24a73e543b062cb Mon Sep 17 00:00:00 2001 +From: Czarek Nakamoto +Date: Mon, 9 Dec 2024 11:21:06 -0500 +Subject: [PATCH] fix error messages with coin control + +--- + src/wallet/api/wallet.cpp | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp +index de507b3..731055a 100644 +--- a/src/wallet/api/wallet.cpp ++++ b/src/wallet/api/wallet.cpp +@@ -2156,8 +2156,9 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector preferred_input_list; ++ uint64_t max_coin_control_input = 0; + if (!preferred_inputs.empty()) { +- LOG_ERROR("empty"); ++ LOG_ERROR("not empty"); + + for (const auto &public_key : preferred_inputs) { + crypto::key_image keyImage; +@@ -2173,6 +2174,13 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectorget_num_transfer_details(); ++i) { ++ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i); ++ if (td.m_key_image == keyImage) { ++ max_coin_control_input += td.amount(); ++ } ++ } ++ + preferred_input_list.push_back(keyImage); + } + } else { +@@ -2252,6 +2260,11 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector Date: Wed, 11 Dec 2024 20:48:13 -0500 Subject: detailed error messages (#95) --- ...0021-fix-error-messages-with-coin-control.patch | 57 +++++++++++++++++++--- 1 file changed, 50 insertions(+), 7 deletions(-) (limited to 'patches') diff --git a/patches/monero/0021-fix-error-messages-with-coin-control.patch b/patches/monero/0021-fix-error-messages-with-coin-control.patch index b4e3625..1caf15c 100644 --- a/patches/monero/0021-fix-error-messages-with-coin-control.patch +++ b/patches/monero/0021-fix-error-messages-with-coin-control.patch @@ -1,28 +1,29 @@ -From 6259ee6acea965c2bc0bc2e4a24a73e543b062cb Mon Sep 17 00:00:00 2001 +From 1737ff03788db38d198955dab136d0388d674ba2 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Mon, 9 Dec 2024 11:21:06 -0500 Subject: [PATCH] fix error messages with coin control --- - src/wallet/api/wallet.cpp | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) + src/wallet/api/wallet.cpp | 44 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index de507b3..731055a 100644 +index de507b3de..3e33a318c 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp -@@ -2156,8 +2156,9 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector preferred_input_list; + uint64_t max_coin_control_input = 0; ++ uint64_t max_frozen_input = 0; if (!preferred_inputs.empty()) { - LOG_ERROR("empty"); + LOG_ERROR("not empty"); for (const auto &public_key : preferred_inputs) { crypto::key_image keyImage; -@@ -2173,6 +2174,13 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector Date: Mon, 30 Dec 2024 13:49:32 +0000 Subject: update coin-control patch --- patches/monero/0009-coin-control.patch | 105 ++++++++++++++++++++++++++------- 1 file changed, 84 insertions(+), 21 deletions(-) (limited to 'patches') diff --git a/patches/monero/0009-coin-control.patch b/patches/monero/0009-coin-control.patch index 1aac12a..4c4b842 100644 --- a/patches/monero/0009-coin-control.patch +++ b/patches/monero/0009-coin-control.patch @@ -1,7 +1,7 @@ -From 4d897d9ee1d24710500f4d58e9ccd79fb48cf1d2 Mon Sep 17 00:00:00 2001 +From d15a18cac55cb06d5421ecfef1118e439d0cd572 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 12 Mar 2024 11:07:57 +0100 -Subject: [PATCH 09/14] coin control +Subject: [PATCH 10/15] coin control --- src/simplewallet/simplewallet.cpp | 2 +- @@ -10,19 +10,19 @@ Subject: [PATCH 09/14] coin control src/wallet/api/coins.h | 40 +++++++ src/wallet/api/coins_info.cpp | 122 ++++++++++++++++++++ src/wallet/api/coins_info.h | 71 ++++++++++++ - src/wallet/api/wallet.cpp | 64 +++++++++- + src/wallet/api/wallet.cpp | 106 ++++++++++++++++- 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(-) + 11 files changed, 635 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 2c51337..645bd37 100644 +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 @@ -35,7 +35,7 @@ index 2c51337..645bd37 100644 if (ptx_vector.empty()) { diff --git a/src/wallet/api/CMakeLists.txt b/src/wallet/api/CMakeLists.txt -index af7948d..bb740e2 100644 +index af7948d8a..bb740e2ac 100644 --- a/src/wallet/api/CMakeLists.txt +++ b/src/wallet/api/CMakeLists.txt @@ -40,7 +40,9 @@ set(wallet_api_sources @@ -62,7 +62,7 @@ index af7948d..bb740e2 100644 ${wallet_api_private_headers}) diff --git a/src/wallet/api/coins.cpp b/src/wallet/api/coins.cpp new file mode 100644 -index 0000000..ef12141 +index 000000000..ef12141cf --- /dev/null +++ b/src/wallet/api/coins.cpp @@ -0,0 +1,186 @@ @@ -254,7 +254,7 @@ index 0000000..ef12141 +} // namespace diff --git a/src/wallet/api/coins.h b/src/wallet/api/coins.h new file mode 100644 -index 0000000..b7a0a86 +index 000000000..b7a0a8642 --- /dev/null +++ b/src/wallet/api/coins.h @@ -0,0 +1,40 @@ @@ -300,7 +300,7 @@ index 0000000..b7a0a86 +#endif //FEATHER_COINS_H diff --git a/src/wallet/api/coins_info.cpp b/src/wallet/api/coins_info.cpp new file mode 100644 -index 0000000..5f2c4e1 +index 000000000..5f2c4e1e4 --- /dev/null +++ b/src/wallet/api/coins_info.cpp @@ -0,0 +1,122 @@ @@ -428,7 +428,7 @@ index 0000000..5f2c4e1 +namespace Bitmonero = Monero; diff --git a/src/wallet/api/coins_info.h b/src/wallet/api/coins_info.h new file mode 100644 -index 0000000..c43e45a +index 000000000..c43e45abd --- /dev/null +++ b/src/wallet/api/coins_info.h @@ -0,0 +1,71 @@ @@ -504,7 +504,7 @@ index 0000000..c43e45a + +#endif //FEATHER_COINS_INFO_H diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index 67ac90a..6bb3a21 100644 +index 67ac90a46..a76d773ba 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -35,6 +35,7 @@ @@ -548,7 +548,7 @@ index 67ac90a..6bb3a21 100644 de.is_subaddress = info.is_subaddress; de.is_integrated = info.has_payment_id; dsts.push_back(de); -@@ -2115,6 +2119,51 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector preferred_input_list; ++ uint64_t max_coin_control_input = 0; ++ uint64_t max_frozen_input = 0; + if (!preferred_inputs.empty()) { -+ LOG_ERROR("empty"); ++ LOG_ERROR("not empty"); + + for (const auto &public_key : preferred_inputs) { + crypto::key_image keyImage; @@ -576,6 +578,16 @@ index 67ac90a..6bb3a21 100644 + break; + } + ++ 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); ++ if (td.m_key_image == keyImage) { ++ max_coin_control_input += td.amount(); ++ } ++ if (td.m_frozen) { ++ max_frozen_input += td.amount(); ++ } ++ } ++ + preferred_input_list.push_back(keyImage); + } + } else { @@ -600,7 +612,7 @@ index 67ac90a..6bb3a21 100644 if (error) { break; } -@@ -2129,11 +2178,11 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectorm_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, adjusted_priority, @@ -614,7 +626,58 @@ index 67ac90a..6bb3a21 100644 } pendingTxPostProcess(transaction); -@@ -2214,10 +2263,10 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector amount, uint32_t mixin_count, @@ -627,7 +690,7 @@ index 67ac90a..6bb3a21 100644 } PendingTransaction *WalletImpl::createSweepUnmixableTransaction() -@@ -2342,6 +2391,11 @@ AddressBook *WalletImpl::addressBook() +@@ -2342,6 +2433,11 @@ AddressBook *WalletImpl::addressBook() return m_addressBook.get(); } @@ -640,7 +703,7 @@ index 67ac90a..6bb3a21 100644 { return m_subaddress.get(); diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h -index 32e1228..a82f270 100644 +index 32e12284b..a82f270e4 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -46,6 +46,7 @@ class PendingTransactionImpl; @@ -693,7 +756,7 @@ index 32e1228..a82f270 100644 // multi-threaded refresh stuff diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h -index be1c370..013b5bc 100644 +index be1c3704e..013b5bcba 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -263,6 +263,51 @@ struct AddressBook @@ -777,7 +840,7 @@ index be1c370..013b5bc 100644 virtual SubaddressAccount * subaddressAccount() = 0; virtual void setListener(WalletListener *) = 0; diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp -index fa346a9..d060bf9 100644 +index fa346a96e..d060bf95b 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2094,12 +2094,21 @@ bool wallet2::frozen(const multisig_tx_set& txs) const @@ -924,7 +987,7 @@ index fa346a9..d060bf9 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 91cf2a3..bc16d52 100644 +index 91cf2a376..bc16d528c 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -1209,8 +1209,8 @@ private: @@ -975,5 +1038,5 @@ index 91cf2a3..bc16d52 100644 void set_unspent(size_t idx); bool is_spent(const transfer_details &td, bool strict = true) const; -- -2.39.5 (Apple Git-154) +2.43.0 -- cgit v1.2.3 From 785aca81ea4aa0081a92198e19d680d9661cba9d Mon Sep 17 00:00:00 2001 From: cyan Date: Mon, 30 Dec 2024 13:50:10 +0000 Subject: remove patch --- ...0021-fix-error-messages-with-coin-control.patch | 96 ---------------------- 1 file changed, 96 deletions(-) delete mode 100644 patches/monero/0021-fix-error-messages-with-coin-control.patch (limited to 'patches') diff --git a/patches/monero/0021-fix-error-messages-with-coin-control.patch b/patches/monero/0021-fix-error-messages-with-coin-control.patch deleted file mode 100644 index 1caf15c..0000000 --- a/patches/monero/0021-fix-error-messages-with-coin-control.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 1737ff03788db38d198955dab136d0388d674ba2 Mon Sep 17 00:00:00 2001 -From: Czarek Nakamoto -Date: Mon, 9 Dec 2024 11:21:06 -0500 -Subject: [PATCH] fix error messages with coin control - ---- - src/wallet/api/wallet.cpp | 44 ++++++++++++++++++++++++++++++++++++++- - 1 file changed, 43 insertions(+), 1 deletion(-) - -diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp -index de507b3de..3e33a318c 100644 ---- a/src/wallet/api/wallet.cpp -+++ b/src/wallet/api/wallet.cpp -@@ -2156,8 +2156,10 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector preferred_input_list; -+ uint64_t max_coin_control_input = 0; -+ uint64_t max_frozen_input = 0; - if (!preferred_inputs.empty()) { -- LOG_ERROR("empty"); -+ LOG_ERROR("not empty"); - - for (const auto &public_key : preferred_inputs) { - crypto::key_image keyImage; -@@ -2173,6 +2175,16 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vectorget_num_transfer_details(); ++i) { -+ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i); -+ if (td.m_key_image == keyImage) { -+ max_coin_control_input += td.amount(); -+ } -+ if (td.m_frozen) { -+ max_frozen_input += td.amount(); -+ } -+ } -+ - preferred_input_list.push_back(keyImage); - } - } else { -@@ -2236,6 +2248,16 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector