aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-27 10:41:25 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:30:42 +0100
commit4a41dd4068e9c985d98f046fe328193630002875 (patch)
tree0b98e4f3beae03c1af46800dca634e1e0d8c442b /src
parentcore: use full rct signatures if just one input (diff)
downloadmonero-4a41dd4068e9c985d98f046fe328193630002875.tar.xz
wallet: do not generate 0 change
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index d80c746a4..0a2a5ec9d 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -3047,9 +3047,12 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
}
cryptonote::tx_destination_entry change_dts = AUTO_VAL_INIT(change_dts);
- change_dts.addr = m_account.get_keys().m_account_address;
- change_dts.amount = found_money - needed_money; // may be 0, we allow 0 change
- dsts.push_back(change_dts);
+ if (needed_money < found_money)
+ {
+ change_dts.addr = m_account.get_keys().m_account_address;
+ change_dts.amount = found_money - needed_money;
+ dsts.push_back(change_dts);
+ }
crypto::secret_key tx_key;
bool r = cryptonote::construct_tx_and_get_tx_key(m_account.get_keys(), sources, dsts, extra, tx, unlock_time, tx_key, true);