diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2023-04-18 19:04:03 -0700 |
---|---|---|
committer | Amiti Uttarwar <amiti@uttarwar.org> | 2023-04-20 19:16:36 -0700 |
commit | 10a354f1740a5c1b913d0b6951e80fb5401ab43a (patch) | |
tree | 1cf0e0cce077d7a9dec47d37d53ac4b25efa8366 /src/test/addrman_tests.cpp | |
parent | 4c40837a454996c9f704ebf060efd6b249f2e362 (diff) | |
download | bitcoin-10a354f1740a5c1b913d0b6951e80fb5401ab43a.tar.xz |
test: prevent intermittent failures
Add to the tried table before the new table to make sure a new table collision
is not possible
Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
Diffstat (limited to 'src/test/addrman_tests.cpp')
-rw-r--r-- | src/test/addrman_tests.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/addrman_tests.cpp b/src/test/addrman_tests.cpp index b5f9558337..54d923e4a4 100644 --- a/src/test/addrman_tests.cpp +++ b/src/test/addrman_tests.cpp @@ -256,10 +256,7 @@ BOOST_AUTO_TEST_CASE(addrman_select_special) // use a non-deterministic addrman to ensure a passing test isn't due to setup auto addrman = std::make_unique<AddrMan>(EMPTY_NETGROUPMAN, /*deterministic=*/false, GetCheckRatio(m_node)); - // add ipv4 address to the new table CNetAddr source = ResolveIP("252.2.2.2"); - CService addr1 = ResolveService("250.1.1.3", 8333); - BOOST_CHECK(addrman->Add({CAddress(addr1, NODE_NONE)}, source)); // add I2P address to the tried table CAddress i2p_addr; @@ -267,6 +264,10 @@ BOOST_AUTO_TEST_CASE(addrman_select_special) BOOST_CHECK(addrman->Add({i2p_addr}, source)); BOOST_CHECK(addrman->Good(i2p_addr)); + // add ipv4 address to the new table + CService addr1 = ResolveService("250.1.1.3", 8333); + BOOST_CHECK(addrman->Add({CAddress(addr1, NODE_NONE)}, source)); + // since the only ipv4 address is on the new table, ensure that the new // table gets selected even if new_only is false. if the table was being // selected at random, this test will sporadically fail |