diff options
| author | Riccardo Spagni <ric@spagni.net> | 2019-03-14 09:41:01 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2019-03-14 09:41:02 +0200 |
| commit | 503b2fd964342a63876a7d16539ae9ceb27b7b70 (patch) | |
| tree | fe49dccde790c70ca183d9517538184a9232627b | |
| parent | 1d1a02e9f91c2a93eacb0bc89cbb5e5fddceca39 (diff) | |
| parent | bc61b5ca951c2cf7331e56746c46fd5a17cc57b4 (diff) | |
| download | monzero-core-503b2fd964342a63876a7d16539ae9ceb27b7b70.tar.gz monzero-core-503b2fd964342a63876a7d16539ae9ceb27b7b70.tar.xz monzero-core-503b2fd964342a63876a7d16539ae9ceb27b7b70.zip | |
Merge pull request #5273
bc61b5ca wallet2: don't store 0 amount outputs, they'll fail to be spent (moneromooo-monero)
| -rw-r--r-- | src/wallet/wallet2.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 085e6075f..11be8fd6e 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1495,11 +1495,17 @@ void wallet2::scan_output(const cryptonote::transaction &tx, bool miner_tx, cons } THROW_WALLET_EXCEPTION_IF(std::find(outs.begin(), outs.end(), i) != outs.end(), error::wallet_internal_error, "Same output cannot be added twice"); - outs.push_back(i); if (tx_scan_info.money_transfered == 0 && !miner_tx) { tx_scan_info.money_transfered = tools::decodeRct(tx.rct_signatures, tx_scan_info.received->derivation, i, tx_scan_info.mask, m_account.get_device()); } + if (tx_scan_info.money_transfered == 0) + { + MERROR("Invalid output amount, skipping"); + tx_scan_info.error = true; + return; + } + outs.push_back(i); THROW_WALLET_EXCEPTION_IF(tx_money_got_in_outs[tx_scan_info.received->index] >= std::numeric_limits<uint64_t>::max() - tx_scan_info.money_transfered, error::wallet_internal_error, "Overflow in received amounts"); tx_money_got_in_outs[tx_scan_info.received->index] += tx_scan_info.money_transfered; |
