Fix denial of service tests

Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
This commit is contained in:
Anthony Fieroni 2019-01-31 11:06:11 +02:00 committed by lbrynaut
parent 30e18de527
commit 2069a84704

View file

@ -146,7 +146,14 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management)
BOOST_CHECK(node->fDisconnect == false);
}
SetMockTime(GetTime() + 3*consensusParams.nPowTargetSpacing + 1);
// STALE_CHECK_INTERVAL is used in PeerLogicValidation::CheckForStaleTipAndEvictPeers
// as minimal time to check tip stale i.e. 10 minutes
// we use maximum value of STALE_CHECK_INTERVAL and nPowTargetSpacing
// NOTE: STALE_CHECK_INTERVAL is static that why we use raw value 10 * 60, sync may need in future
auto time = std::max(long(10) * 60, 3 * consensusParams.nPowTargetSpacing);
SetMockTime(GetTime() + time + 1);
// Now tip should definitely be stale, and we should look for an extra
// outbound peer