aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-11-13 14:08:10 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-11-13 14:08:10 +0000
commit7e387fb1ad87bd99130defea6e013a4a40952ebb (patch)
tree74a4284e026cb0d18e134d2f0d0b34a9d21302f9 /src/wallet/wallet2.cpp
parentMerge pull request #2694 (diff)
downloadmonero-7e387fb1ad87bd99130defea6e013a4a40952ebb.tar.xz
wallet2: only add a dummy 0 output if there's one output otherwise
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index a87803206..e9af93c05 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -4663,21 +4663,25 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
change_dts.amount = found_money - needed_money;
if (change_dts.amount == 0)
{
- // If the change is 0, send it to a random address, to avoid confusing
- // the sender with a 0 amount output. We send a 0 amount in order to avoid
- // letting the destination be able to work out which of the inputs is the
- // real one in our rings
- LOG_PRINT_L2("generating dummy address for 0 change");
- cryptonote::account_base dummy;
- dummy.generate();
- change_dts.addr = dummy.get_keys().m_account_address;
- LOG_PRINT_L2("generated dummy address for 0 change");
+ if (splitted_dsts.size() == 1)
+ {
+ // If the change is 0, send it to a random address, to avoid confusing
+ // the sender with a 0 amount output. We send a 0 amount in order to avoid
+ // letting the destination be able to work out which of the inputs is the
+ // real one in our rings
+ LOG_PRINT_L2("generating dummy address for 0 change");
+ cryptonote::account_base dummy;
+ dummy.generate();
+ change_dts.addr = dummy.get_keys().m_account_address;
+ LOG_PRINT_L2("generated dummy address for 0 change");
+ splitted_dsts.push_back(change_dts);
+ }
}
else
{
change_dts.addr = get_subaddress({subaddr_account, 0});
+ splitted_dsts.push_back(change_dts);
}
- splitted_dsts.push_back(change_dts);
crypto::secret_key tx_key;
std::vector<crypto::secret_key> additional_tx_keys;