From c7004d0420bc6aec11c0da9bf80e6bf711af160b Mon Sep 17 00:00:00 2001 From: sowle Date: Wed, 16 Oct 2019 16:32:58 +0300 Subject: [PATCH] coretests: test_chain_unit_enchanced::remove_stuck_txs added --- tests/core_tests/chaingen.cpp | 11 +++++++++++ tests/core_tests/chaingen.h | 1 + 2 files changed, 12 insertions(+) diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp index bc10214f..f6180f54 100644 --- a/tests/core_tests/chaingen.cpp +++ b/tests/core_tests/chaingen.cpp @@ -2057,6 +2057,7 @@ test_chain_unit_enchanced::test_chain_unit_enchanced() REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, check_tx_pool_empty); REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, check_tx_pool_count); REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, print_tx_pool); + REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, remove_stuck_txs); REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, check_offers_count); } @@ -2122,6 +2123,16 @@ bool test_chain_unit_enchanced::print_tx_pool(currency::core& c, size_t ev_index return true; } +bool test_chain_unit_enchanced::remove_stuck_txs(currency::core& c, size_t ev_index, const std::vector& events) +{ + size_t tx_count_before = c.get_pool_transactions_count(); + bool r = c.get_tx_pool().remove_stuck_transactions(); + CHECK_AND_ASSERT_MES(r, false, "remove_stuck_transactions() failed"); + + LOG_PRINT_L0("stuck txs removed from the pool, pool tx count: " << tx_count_before << " -> " << c.get_pool_transactions_count()); + return true; +} + std::string print_market(bc_services::bc_offers_service* offers_service) { std::stringstream ss; diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index c9eec9ea..cc270d38 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -297,6 +297,7 @@ public: bool check_tx_pool_empty(currency::core& c, size_t ev_index, const std::vector& events); bool check_tx_pool_count(currency::core& c, size_t ev_index, const std::vector& events); bool print_tx_pool(currency::core& c, size_t ev_index, const std::vector& events); + bool remove_stuck_txs(currency::core& c, size_t ev_index, const std::vector& events); bool check_offers_count(currency::core& c, size_t ev_index, const std::vector& events); protected: