diff options
| author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-01-29 17:15:09 +0000 |
|---|---|---|
| committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-01-29 17:21:25 +0000 |
| commit | 94b98fb5fa98ca317664b96d6a564159945de95e (patch) | |
| tree | d0b53033cc335f33dd383ae38188ff7af5a072f0 /src/cryptonote_core/tx_pool.cpp | |
| parent | eadbdf354a3a3135fd235ce3cce47d8b89f7b279 (diff) | |
| download | monzero-core-94b98fb5fa98ca317664b96d6a564159945de95e.tar.gz monzero-core-94b98fb5fa98ca317664b96d6a564159945de95e.tar.xz monzero-core-94b98fb5fa98ca317664b96d6a564159945de95e.zip | |
tx_pool: do not accept txes not in a block if they timed out before
This is intended to avoid cases where a timed out tx will be
re-relayed by another peer for which it has not timed out yet,
which would cause the tx to stay in the network's pool for a
long time (until all peers time it out before another one
tries to relay it again).
Diffstat (limited to 'src/cryptonote_core/tx_pool.cpp')
| -rw-r--r-- | src/cryptonote_core/tx_pool.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 2cef68a85..5d67acdd2 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -84,7 +84,15 @@ namespace cryptonote //--------------------------------------------------------------------------------- bool tx_memory_pool::add_tx(const transaction &tx, /*const crypto::hash& tx_prefix_hash,*/ const crypto::hash &id, size_t blob_size, tx_verification_context& tvc, bool kept_by_block, bool relayed, uint8_t version) { - + // we do not accept transactions that timed out before, unless they're + // kept_by_block + if (!kept_by_block && m_timed_out_transactions.find(id) != m_timed_out_transactions.end()) + { + // not clear if we should set that, since verifivation (sic) did not fail before, since + // the tx was accepted before timing out. + tvc.m_verifivation_failed = true; + return false; + } if(!check_inputs_types_supported(tx)) { @@ -315,6 +323,7 @@ namespace cryptonote { m_txs_by_fee.erase(sorted_it); } + m_timed_out_transactions.insert(it->first); auto pit = it++; m_transactions.erase(pit); }else |
