From 2a12f5ecb5080fe0a25d796a4f780dede87de26f Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 13 Feb 2020 15:55:58 +0300 Subject: [PATCH] tx pool: new soft rule: standalone txs will be rejected while BCS is in CP zone (more security when checkpoints will be enabled) (also, this should fix gen_checkpoints_and_invalid_tx_to_pool test that was especially written to cover this case) --- src/currency_core/tx_pool.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/currency_core/tx_pool.cpp b/src/currency_core/tx_pool.cpp index 5e1f7640..968ac997 100644 --- a/src/currency_core/tx_pool.cpp +++ b/src/currency_core/tx_pool.cpp @@ -91,6 +91,16 @@ namespace currency //--------------------------------------------------------------------------------- bool tx_memory_pool::add_tx(const transaction &tx, const crypto::hash &id, uint64_t blob_size, tx_verification_context& tvc, bool kept_by_block, bool from_core) { + if (!kept_by_block && !from_core && m_blockchain.is_in_checkpoint_zone()) + { + // BCS is in CP zone, tx verification is impossible until it gets synchronized + tvc.m_added_to_pool = false; + tvc.m_should_be_relayed = false; + tvc.m_verification_failed = false; + tvc.m_verification_impossible = true; + return false; + } + TIME_MEASURE_START_PD(tx_processing_time); TIME_MEASURE_START_PD(check_inputs_types_supported_time); if(!check_inputs_types_supported(tx))