mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 16:48:53 +00:00
wallet2: support multi out txes without change in sanity check
This commit is contained in:
parent
1ef3d05c4a
commit
15f27c80b9
@ -9530,14 +9530,16 @@ bool wallet2::sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, s
|
|||||||
change -= r.second.first;
|
change -= r.second.first;
|
||||||
MDEBUG("Adding " << cryptonote::print_money(change) << " expected change");
|
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)
|
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");
|
if (ptx.change_dts.amount == 0)
|
||||||
const auto it = m_subaddresses.find(ptx_vector[0].change_dts.addr.m_spend_public_key);
|
continue;
|
||||||
THROW_WALLET_EXCEPTION_IF(change > 0 && it == m_subaddresses.end(), error::wallet_internal_error, "Change address is not ours");
|
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_vector[0].change_dts.addr].first += change;
|
required[ptx.change_dts.addr].first += ptx.change_dts.amount;
|
||||||
required[ptx_vector[0].change_dts.addr].second = ptx_vector[0].change_dts.is_subaddress;
|
required[ptx.change_dts.addr].second = ptx.change_dts.is_subaddress;
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto &r: required)
|
for (const auto &r: required)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user