diff options
author | stoffu <stoffu@protonmail.ch> | 2018-02-10 12:59:25 +0900 |
---|---|---|
committer | stoffu <stoffu@protonmail.ch> | 2018-02-10 12:59:25 +0900 |
commit | 0133b3481a43c92edfff253722f544d12d040fa9 (patch) | |
tree | 2c9f817744ec2a24dac2013eb76eadd90a5ec9b6 | |
parent | Merge pull request #3198 (diff) | |
download | monero-0133b3481a43c92edfff253722f544d12d040fa9.tar.xz |
wallet2: don't throw when spent amount is inconsistent
-rw-r--r-- | src/wallet/wallet2.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 7dc8a1e47..364ab9c06 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1313,11 +1313,21 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote uint64_t amount = boost::get<cryptonote::txin_to_key>(in).amount; if (amount > 0) { - THROW_WALLET_EXCEPTION_IF(amount != td.amount(), error::wallet_internal_error, - std::string("Inconsistent amount in tx input: got ") + print_money(amount) + - std::string(", expected ") + print_money(td.amount())); + if(amount != td.amount()) + { + MERROR("Inconsistent amount in tx input: got " << print_money(amount) << + ", expected " << print_money(td.amount())); + // this means: + // 1) the same output pub key was used as destination multiple times, + // 2) the wallet set the highest amount among them to transfer_details::m_amount, and + // 3) the wallet somehow spent that output with an amount smaller than the above amount, causing inconsistency + td.m_amount = amount; + } + } + else + { + amount = td.amount(); } - amount = td.amount(); tx_money_spent_in_ins += amount; if (subaddr_account && *subaddr_account != td.m_subaddr_index.major) LOG_ERROR("spent funds are from different subaddress accounts; count of incoming/outgoing payments will be incorrect"); |