aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-15 09:17:06 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-15 09:17:07 +0200
commit98f4c8af9823dda704dd82ecf5aa45f57e5a6f69 (patch)
treeef4c7e79385d53deaa91152a882be7d228929f93 /src/wallet
parentMerge pull request #5393 (diff)
parentwallet2: support multi out txes without change in sanity check (diff)
downloadmonero-98f4c8af9823dda704dd82ecf5aa45f57e5a6f69.tar.xz
Merge pull request #5395
15f27c80 wallet2: support multi out txes without change in sanity check (moneromooo-monero)
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 812ca9ca5..2ae05162a 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -9627,14 +9627,16 @@ bool wallet2::sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, s
change -= r.second.first;
MDEBUG("Adding " << cryptonote::print_money(change) << " expected change");
+ // for all txes that have actual change, check change is coming back to the sending wallet
for (const pending_tx &ptx: ptx_vector)
- THROW_WALLET_EXCEPTION_IF(ptx.change_dts.addr != ptx_vector[0].change_dts.addr, error::wallet_internal_error,
- "Change goes to several different addresses");
- const auto it = m_subaddresses.find(ptx_vector[0].change_dts.addr.m_spend_public_key);
- THROW_WALLET_EXCEPTION_IF(change > 0 && it == m_subaddresses.end(), error::wallet_internal_error, "Change address is not ours");
-
- required[ptx_vector[0].change_dts.addr].first += change;
- required[ptx_vector[0].change_dts.addr].second = ptx_vector[0].change_dts.is_subaddress;
+ {
+ if (ptx.change_dts.amount == 0)
+ continue;
+ THROW_WALLET_EXCEPTION_IF(m_subaddresses.find(ptx.change_dts.addr.m_spend_public_key) == m_subaddresses.end(),
+ error::wallet_internal_error, "Change address is not ours");
+ required[ptx.change_dts.addr].first += ptx.change_dts.amount;
+ required[ptx.change_dts.addr].second = ptx.change_dts.is_subaddress;
+ }
for (const auto &r: required)
{