diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-03-22 20:21:54 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-03-23 09:25:29 +0000 |
commit | aaeb164cf6fa5ff4c8631dd77e434c3259d6b14e (patch) | |
tree | 727e66d4127ab7d7c7beff6f7e4f0d3f709fed36 | |
parent | core, wallet: faster tx pool scanning (diff) | |
download | monero-aaeb164cf6fa5ff4c8631dd77e434c3259d6b14e.tar.xz |
tx_pool: remove transactions if they're in the blockchain
When starting up, if the pool state was not saved, the pool
might contain transactions which made it into the blockchain,
so these need removing
-rw-r--r-- | src/cryptonote_core/tx_pool.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index b2a7120cb..93fe57232 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -717,8 +717,16 @@ namespace cryptonote size_t n_removed = 0; size_t tx_size_limit = get_transaction_size_limit(version); for (auto it = m_transactions.begin(); it != m_transactions.end(); ) { + bool remove = false; if (it->second.blob_size >= tx_size_limit) { - LOG_PRINT_L1("Transaction " << get_transaction_hash(it->second.tx) << " is too big (" << it->second.blob_size << " bytes), removing it from pool"); + LOG_PRINT_L1("Transaction " << it->first << " is too big (" << it->second.blob_size << " bytes), removing it from pool"); + remove = true; + } + else if (m_blockchain.have_tx(it->first)) { + LOG_PRINT_L1("Transaction " << it->first << " is in the blockchain, removing it from pool"); + remove = true; + } + if (remove) { remove_transaction_keyimages(it->second.tx); auto sorted_it = find_tx_in_sorted_container(it->first); if (sorted_it == m_txs_by_fee_and_receive_time.end()) |