wallet2: fix transfers between subaddresses hitting the sanity check

Transfers between subaddresses are accounted for differently
This commit is contained in:
moneromooo-monero 2018-09-28 10:17:17 +00:00
parent 8bf5a00564
commit 7dd11711b0
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -1707,10 +1707,14 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
} }
// remove change sent to the spending subaddress account from the list of received funds // remove change sent to the spending subaddress account from the list of received funds
uint64_t sub_change = 0;
for (auto i = tx_money_got_in_outs.begin(); i != tx_money_got_in_outs.end();) for (auto i = tx_money_got_in_outs.begin(); i != tx_money_got_in_outs.end();)
{ {
if (subaddr_account && i->first.major == *subaddr_account) if (subaddr_account && i->first.major == *subaddr_account)
{
sub_change += i->second;
i = tx_money_got_in_outs.erase(i); i = tx_money_got_in_outs.erase(i);
}
else else
++i; ++i;
} }
@ -1755,7 +1759,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
} }
} }
uint64_t total_received_2 = 0; uint64_t total_received_2 = sub_change;
for (const auto& i : tx_money_got_in_outs) for (const auto& i : tx_money_got_in_outs)
total_received_2 += i.second; total_received_2 += i.second;
if (total_received_1 != total_received_2) if (total_received_1 != total_received_2)