From 7c2ec3949aa304607e2ba3abddc73a2ed49a14b9 Mon Sep 17 00:00:00 2001 From: seduless Date: Fri, 17 Apr 2026 22:51:24 +0000 Subject: [PATCH] test: Enter mocktime before peer creation in block_relay_only_eviction This is a follow-up to commit faad08e59c4419e09eb75054bf468ca98a837ca8. Hoisting the NodeClockContext above peer creation ensures m_connected is captured under mocktime, making the MINIMUM_CONNECT_TIME check deterministic regardless of which peer is selected for eviction. This is a prerequisite for the next commit, which removes the one-second advance from the NodeClockContext default constructor. --- src/test/denialofservice_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/denialofservice_tests.cpp b/src/test/denialofservice_tests.cpp index 9709eacd8b7..13b32b4fe22 100644 --- a/src/test/denialofservice_tests.cpp +++ b/src/test/denialofservice_tests.cpp @@ -243,6 +243,7 @@ BOOST_FIXTURE_TEST_CASE(stale_tip_peer_management, OutboundTest) BOOST_FIXTURE_TEST_CASE(block_relay_only_eviction, OutboundTest) { NodeId id{0}; + NodeClockContext clock_ctx{}; auto connman = std::make_unique(0x1337, 0x1337, *m_node.addrman, *m_node.netgroupman, Params()); auto peerLogic = PeerManager::make(*connman, *m_node.addrman, nullptr, *m_node.chainman, *m_node.mempool, *m_node.warnings, {}); @@ -274,7 +275,6 @@ BOOST_FIXTURE_TEST_CASE(block_relay_only_eviction, OutboundTest) } BOOST_CHECK(vNodes.back()->fDisconnect == false); - NodeClockContext clock_ctx{}; clock_ctx += MINIMUM_CONNECT_TIME; peerLogic->CheckForStaleTipAndEvictPeers(); for (int i = 0; i < max_outbound_block_relay; ++i) {