From c7f0106bf0174574f060e3f5a2d89fb97ec2321c Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 3 Apr 2025 18:59:51 +0300 Subject: [PATCH 1/2] experimental improvements for purge_transaction_from_blockchain() --- src/currency_core/blockchain_storage.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 83245333..f7d272d3 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -901,16 +901,15 @@ bool blockchain_storage::purge_transaction_from_blockchain(const crypto::hash& t { currency::tx_verification_context tvc = AUTO_VAL_INIT(tvc); added_to_the_pool = m_tx_pool.add_tx(tx, tvc, true, true); - CHECK_AND_ASSERT_MES(added_to_the_pool, false, "failed to add transaction " << tx_id << " to transaction pool"); } - bool res = pop_transaction_from_global_index(tx, tx_id); - CHECK_AND_ASSERT_MES_NO_RET(res, "pop_transaction_from_global_index failed for tx " << tx_id); + bool res_pop_gi = pop_transaction_from_global_index(tx, tx_id); + CHECK_AND_ASSERT_MES_NO_RET(res_pop_gi, "serious internal error: pop_transaction_from_global_index() failed for tx " << tx_id); bool res_erase = m_db_transactions.erase_validate(tx_id); - CHECK_AND_ASSERT_MES_NO_RET(res_erase, "Failed to m_transactions.erase with id = " << tx_id); + CHECK_AND_ASSERT_MES_NO_RET(res_erase, "serious internal error: m_transactions.erase_validate() failed for tx " << tx_id); LOG_PRINT_L1("transaction " << tx_id << " from block @ " << tx_res_ptr->m_keeper_block_height << (added_to_the_pool ? " was removed from blockchain history -> to the pool" : " was removed from blockchain history")); - return res; + return res_pop_gi && res_erase; } //------------------------------------------------------------------ From 77361991896e23e4496d3ba62062b53f1b02c5d5 Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 3 Apr 2025 23:32:21 +0300 Subject: [PATCH 2/2] minor improvement (log) --- src/currency_core/blockchain_storage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index f7d272d3..302661df 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -908,7 +908,9 @@ bool blockchain_storage::purge_transaction_from_blockchain(const crypto::hash& t bool res_erase = m_db_transactions.erase_validate(tx_id); CHECK_AND_ASSERT_MES_NO_RET(res_erase, "serious internal error: m_transactions.erase_validate() failed for tx " << tx_id); - LOG_PRINT_L1("transaction " << tx_id << " from block @ " << tx_res_ptr->m_keeper_block_height << (added_to_the_pool ? " was removed from blockchain history -> to the pool" : " was removed from blockchain history")); + LOG_PRINT_L1("transaction " << tx_id << " from block @ " << tx_res_ptr->m_keeper_block_height << + (added_to_the_pool ? " was removed from blockchain history -> to the pool" : " was removed from blockchain history") << + ((res_pop_gi && res_erase) ? "" : " WITH ERRORS (see above)")); return res_pop_gi && res_erase; }