summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorcyan <cyjan@mrcyjanek.net>2024-12-30 13:49:51 +0000
committercyan <cyjan@mrcyjanek.net>2024-12-30 13:49:51 +0000
commitef1ef9c9fcaf18d27be593057e65b8a689bc17f2 (patch)
treea9c412d1969498dbe939ced78860a47d7f6bf807 /patches
parent58267fe5bd07b0a22f533f0139de013ee9087c2f (diff)
parentb39712e526ff18ed82091af4da644140d340262a (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'patches')
-rw-r--r--patches/monero/0021-fix-error-messages-with-coin-control.patch96
1 files changed, 96 insertions, 0 deletions
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..1caf15c
--- /dev/null
+++ b/patches/monero/0021-fix-error-messages-with-coin-control.patch
@@ -0,0 +1,96 @@
+From 1737ff03788db38d198955dab136d0388d674ba2 Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+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<stri
+ // break;
+ // }
+ std::vector<crypto::key_image> 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::vector<stri
+ 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 {
+@@ -2236,6 +2248,16 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
+ writer << boost::format(tr("not enough money to transfer, available only %s, sent amount %s")) %
+ print_money(e.available()) %
+ print_money(e.tx_amount());
++ if (max_coin_control_input != 0 &&
++ max_coin_control_input != e.available()) {
++ writer << std::endl << boost::format(tr("In addition, coin control was enabled for this transaction, limiting available balance to %s. Make sure that you have enough outputs selected in coin control")) %
++ print_money(max_coin_control_input);
++ }
++ if (max_frozen_input != 0 &&
++ max_frozen_input != e.available()) {
++ writer << std::endl << boost::format(tr("In addition, some a total of %s is frozen. Make sure that you have enough outputs unforzen outputs in coin control")) %
++ print_money(max_frozen_input);
++ }
+ setStatusError(writer.str());
+ } catch (const tools::error::not_enough_money& e) {
+ std::ostringstream writer;
+@@ -2243,6 +2265,16 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
+ writer << boost::format(tr("not enough money to transfer, overall balance only %s, sent amount %s")) %
+ print_money(e.available()) %
+ print_money(e.tx_amount());
++ if (max_coin_control_input != 0 &&
++ max_coin_control_input != e.available()) {
++ writer << std::endl << boost::format(tr("In addition, coin control was enabled for this transaction, limiting available balance to %s. Make sure that you have enough outputs selected in coin control")) %
++ print_money(max_coin_control_input);
++ }
++ if (max_frozen_input != 0 &&
++ max_frozen_input != e.available()) {
++ writer << std::endl << boost::format(tr("In addition, some a total of %s is frozen. Make sure that you have enough outputs unforzen outputs in coin control")) %
++ print_money(max_frozen_input);
++ }
+ setStatusError(writer.str());
+ } catch (const tools::error::tx_not_possible& e) {
+ std::ostringstream writer;
+@@ -2252,6 +2284,16 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
+ print_money(e.tx_amount() + e.fee()) %
+ print_money(e.tx_amount()) %
+ print_money(e.fee());
++ if (max_coin_control_input != 0 &&
++ max_coin_control_input != e.available()) {
++ writer << std::endl << boost::format(tr("In addition, coin control was enabled for this transaction, limiting available balance to %s. Make sure that you have enough outputs selected in coin control")) %
++ print_money(max_coin_control_input);
++ }
++ if (max_frozen_input != 0 &&
++ max_frozen_input != e.available()) {
++ writer << std::endl << boost::format(tr("In addition, some a total of %s is frozen. Make sure that you have enough outputs unforzen outputs in coin control")) %
++ print_money(max_frozen_input);
++ }
+ setStatusError(writer.str());
+ } catch (const tools::error::not_enough_outs_to_mix& e) {
+ std::ostringstream writer;
+--
+2.39.5 (Apple Git-154)
+