Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coin control error message #94

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions patches/monero/0021-fix-error-messages-with-coin-control.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
From 6259ee6acea965c2bc0bc2e4a24a73e543b062cb Mon Sep 17 00:00:00 2001
From: Czarek Nakamoto <[email protected]>
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<stri
// break;
// }
std::vector<crypto::key_image> 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::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();
+ }
+ }
+
preferred_input_list.push_back(keyImage);
}
} else {
@@ -2252,6 +2260,11 @@ 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);
+ }
setStatusError(writer.str());
} catch (const tools::error::not_enough_outs_to_mix& e) {
std::ostringstream writer;
--
2.39.5 (Apple Git-154)

Loading