diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/validation_block_tests.cpp | 10 | ||||
-rw-r--r-- | src/test/validationinterface_tests.cpp | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/test/validation_block_tests.cpp b/src/test/validation_block_tests.cpp index c026e0f43d..eed26511dd 100644 --- a/src/test/validation_block_tests.cpp +++ b/src/test/validation_block_tests.cpp @@ -32,7 +32,7 @@ struct MinerTestingSetup : public RegTestingSetup { BOOST_FIXTURE_TEST_SUITE(validation_block_tests, MinerTestingSetup) -struct TestSubscriber : public CValidationInterface { +struct TestSubscriber final : public CValidationInterface { uint256 m_expected_tip; explicit TestSubscriber(uint256 tip) : m_expected_tip(tip) {} @@ -175,8 +175,8 @@ BOOST_AUTO_TEST_CASE(processnewblock_signals_ordering) LOCK(cs_main); initial_tip = ::ChainActive().Tip(); } - TestSubscriber sub(initial_tip->GetBlockHash()); - RegisterValidationInterface(&sub); + auto sub = std::make_shared<TestSubscriber>(initial_tip->GetBlockHash()); + RegisterSharedValidationInterface(sub); // create a bunch of threads that repeatedly process a block generated above at random // this will create parallelism and randomness inside validation - the ValidationInterface @@ -206,10 +206,10 @@ BOOST_AUTO_TEST_CASE(processnewblock_signals_ordering) } SyncWithValidationInterfaceQueue(); - UnregisterValidationInterface(&sub); + UnregisterSharedValidationInterface(sub); LOCK(cs_main); - BOOST_CHECK_EQUAL(sub.m_expected_tip, ::ChainActive().Tip()->GetBlockHash()); + BOOST_CHECK_EQUAL(sub->m_expected_tip, ::ChainActive().Tip()->GetBlockHash()); } /** diff --git a/src/test/validationinterface_tests.cpp b/src/test/validationinterface_tests.cpp index 14f09ae905..d2fc20e625 100644 --- a/src/test/validationinterface_tests.cpp +++ b/src/test/validationinterface_tests.cpp @@ -12,7 +12,6 @@ BOOST_FIXTURE_TEST_SUITE(validationinterface_tests, TestingSetup) -/** struct TestSubscriberNoop final : public CValidationInterface { void BlockChecked(const CBlock&, const BlockValidationState&) override {} }; @@ -34,9 +33,9 @@ BOOST_AUTO_TEST_CASE(unregister_validation_interface_race) std::thread sub{[&] { // keep going for about 1 sec, which is 250k iterations for (int i = 0; i < 250000; i++) { - TestSubscriberNoop sub{}; - RegisterValidationInterface(&sub); - UnregisterValidationInterface(&sub); + auto sub = std::make_shared<TestSubscriberNoop>(); + RegisterSharedValidationInterface(sub); + UnregisterSharedValidationInterface(sub); } // tell the other thread we are done generate = false; @@ -46,7 +45,6 @@ BOOST_AUTO_TEST_CASE(unregister_validation_interface_race) sub.join(); BOOST_CHECK(!generate); } -*/ class TestInterface : public CValidationInterface { |