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