mirror of
https://github.com/monero-project/monero.git
synced 2024-12-15 04:46:31 +02:00
simplewallet: fix cold signing of split transactions
They'd be rejected as suspicious as the change goes to more than one destination. However, split transactions will most likely include fake zero amount change to random addresses, so we only consider change with non zero amount for this.
This commit is contained in:
parent
aae14a107a
commit
9ae566d0dd
@ -3035,6 +3035,7 @@ bool simple_wallet::accept_loaded_tx(const std::function<size_t()> get_num_txes,
|
|||||||
size_t min_mixin = ~0;
|
size_t min_mixin = ~0;
|
||||||
std::unordered_map<std::string, uint64_t> dests;
|
std::unordered_map<std::string, uint64_t> dests;
|
||||||
const std::string wallet_address = m_wallet->get_account().get_public_address_str(m_wallet->testnet());
|
const std::string wallet_address = m_wallet->get_account().get_public_address_str(m_wallet->testnet());
|
||||||
|
int first_known_non_zero_change_index = -1;
|
||||||
for (size_t n = 0; n < get_num_txes(); ++n)
|
for (size_t n = 0; n < get_num_txes(); ++n)
|
||||||
{
|
{
|
||||||
const tools::wallet2::tx_construction_data &cd = get_tx(n);
|
const tools::wallet2::tx_construction_data &cd = get_tx(n);
|
||||||
@ -3069,11 +3070,16 @@ bool simple_wallet::accept_loaded_tx(const std::function<size_t()> get_num_txes,
|
|||||||
fail_msg_writer() << tr("Claimed change is larger than payment to the change address");
|
fail_msg_writer() << tr("Claimed change is larger than payment to the change address");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (memcmp(&cd.change_dts.addr, &get_tx(0).change_dts.addr, sizeof(cd.change_dts.addr)))
|
if (cd.change_dts.amount > 0)
|
||||||
{
|
{
|
||||||
fail_msg_writer() << tr("Change does to more than one address");
|
if (first_known_non_zero_change_index == -1)
|
||||||
|
first_known_non_zero_change_index = n;
|
||||||
|
if (memcmp(&cd.change_dts.addr, &get_tx(first_known_non_zero_change_index).change_dts.addr, sizeof(cd.change_dts.addr)))
|
||||||
|
{
|
||||||
|
fail_msg_writer() << tr("Change goes to more than one address");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
change += cd.change_dts.amount;
|
change += cd.change_dts.amount;
|
||||||
it->second -= cd.change_dts.amount;
|
it->second -= cd.change_dts.amount;
|
||||||
if (it->second == 0)
|
if (it->second == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user