mirror of
https://github.com/monero-project/monero.git
synced 2024-12-25 04:59:43 +00:00
Wallet API: fix Cold signing split tx
This commit is contained in:
parent
c9063c0b8f
commit
0a7885bf19
1 changed files with 10 additions and 4 deletions
|
@ -104,6 +104,7 @@ bool UnsignedTransactionImpl::checkLoadedTx(const std::function<size_t()> get_nu
|
||||||
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.m_wallet->get_account().get_public_address_str(m_wallet.m_wallet->testnet());
|
const std::string wallet_address = m_wallet.m_wallet->get_account().get_public_address_str(m_wallet.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);
|
||||||
|
@ -140,12 +141,17 @@ bool UnsignedTransactionImpl::checkLoadedTx(const std::function<size_t()> get_nu
|
||||||
m_errorString = tr("Claimed change is larger than payment to the change address");
|
m_errorString = 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)
|
||||||
|
{
|
||||||
|
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)))
|
||||||
{
|
{
|
||||||
m_status = Status_Error;
|
m_status = Status_Error;
|
||||||
m_errorString = tr("Change does to more than one address");
|
m_errorString = 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 a new issue