diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-09-08 08:03:01 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-09-08 07:55:11 +0200 |
commit | fa7e407b504bc60c77341f02636ed9d6a4b53d79 (patch) | |
tree | decea0186288e79a84a57e967da16c28d9ee3d4a /src/test/denialofservice_tests.cpp | |
parent | 147d50d63e07f600b414273a9f6b84f9f4ad9696 (diff) |
Do not pass chain params to CheckForStaleTipAndEvictPeers twice
Diffstat (limited to 'src/test/denialofservice_tests.cpp')
-rw-r--r-- | src/test/denialofservice_tests.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/test/denialofservice_tests.cpp b/src/test/denialofservice_tests.cpp index f4d2204e1c..e4ee08db61 100644 --- a/src/test/denialofservice_tests.cpp +++ b/src/test/denialofservice_tests.cpp @@ -153,7 +153,6 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management) auto connman = MakeUnique<CConnmanTest>(0x1337, 0x1337); auto peerLogic = MakeUnique<PeerManager>(chainparams, *connman, nullptr, *m_node.scheduler, *m_node.chainman, *m_node.mempool); - const Consensus::Params& consensusParams = Params().GetConsensus(); constexpr int max_outbound_full_relay = MAX_OUTBOUND_FULL_RELAY_CONNECTIONS; CConnman::Options options; options.nMaxConnections = DEFAULT_MAX_PEER_CONNECTIONS; @@ -168,18 +167,18 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management) AddRandomOutboundPeer(vNodes, *peerLogic, connman.get()); } - peerLogic->CheckForStaleTipAndEvictPeers(consensusParams); + peerLogic->CheckForStaleTipAndEvictPeers(); // No nodes should be marked for disconnection while we have no extra peers for (const CNode *node : vNodes) { BOOST_CHECK(node->fDisconnect == false); } - SetMockTime(GetTime() + 3*consensusParams.nPowTargetSpacing + 1); + SetMockTime(GetTime() + 3 * chainparams.GetConsensus().nPowTargetSpacing + 1); // Now tip should definitely be stale, and we should look for an extra // outbound peer - peerLogic->CheckForStaleTipAndEvictPeers(consensusParams); + peerLogic->CheckForStaleTipAndEvictPeers(); BOOST_CHECK(connman->GetTryNewOutboundPeer()); // Still no peers should be marked for disconnection @@ -192,8 +191,8 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management) // required time connected check should be satisfied). AddRandomOutboundPeer(vNodes, *peerLogic, connman.get()); - peerLogic->CheckForStaleTipAndEvictPeers(consensusParams); - for (int i=0; i<max_outbound_full_relay; ++i) { + peerLogic->CheckForStaleTipAndEvictPeers(); + for (int i = 0; i < max_outbound_full_relay; ++i) { BOOST_CHECK(vNodes[i]->fDisconnect == false); } // Last added node should get marked for eviction @@ -205,8 +204,8 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management) // peer, and check that the next newest node gets evicted. UpdateLastBlockAnnounceTime(vNodes.back()->GetId(), GetTime()); - peerLogic->CheckForStaleTipAndEvictPeers(consensusParams); - for (int i=0; i<max_outbound_full_relay-1; ++i) { + peerLogic->CheckForStaleTipAndEvictPeers(); + for (int i = 0; i < max_outbound_full_relay - 1; ++i) { BOOST_CHECK(vNodes[i]->fDisconnect == false); } BOOST_CHECK(vNodes[max_outbound_full_relay-1]->fDisconnect == true); |