mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-03 12:25:54 +02:00
refactor: De-globalize g_signals
This commit is contained in:
@@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(processnewblock_signals_ordering)
|
||||
bool ignored;
|
||||
// Connect the genesis block and drain any outstanding events
|
||||
BOOST_CHECK(Assert(m_node.chainman)->ProcessNewBlock(std::make_shared<CBlock>(Params().GenesisBlock()), true, true, &ignored));
|
||||
SyncWithValidationInterfaceQueue();
|
||||
m_node.validation_signals->SyncWithValidationInterfaceQueue();
|
||||
|
||||
// subscribe to events (this subscriber will validate event ordering)
|
||||
const CBlockIndex* initial_tip = nullptr;
|
||||
@@ -167,7 +167,7 @@ BOOST_AUTO_TEST_CASE(processnewblock_signals_ordering)
|
||||
initial_tip = m_node.chainman->ActiveChain().Tip();
|
||||
}
|
||||
auto sub = std::make_shared<TestSubscriber>(initial_tip->GetBlockHash());
|
||||
RegisterSharedValidationInterface(sub);
|
||||
m_node.validation_signals->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
|
||||
@@ -196,9 +196,9 @@ BOOST_AUTO_TEST_CASE(processnewblock_signals_ordering)
|
||||
for (auto& t : threads) {
|
||||
t.join();
|
||||
}
|
||||
SyncWithValidationInterfaceQueue();
|
||||
m_node.validation_signals->SyncWithValidationInterfaceQueue();
|
||||
|
||||
UnregisterSharedValidationInterface(sub);
|
||||
m_node.validation_signals->UnregisterSharedValidationInterface(sub);
|
||||
|
||||
LOCK(cs_main);
|
||||
BOOST_CHECK_EQUAL(sub->m_expected_tip, m_node.chainman->ActiveChain().Tip()->GetBlockHash());
|
||||
|
||||
Reference in New Issue
Block a user