Skip to content

Commit 10a354f

Browse files
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>
1 parent 4c40837 commit 10a354f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test/addrman_tests.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,18 @@ BOOST_AUTO_TEST_CASE(addrman_select_special)
256256
// use a non-deterministic addrman to ensure a passing test isn't due to setup
257257
auto addrman = std::make_unique<AddrMan>(EMPTY_NETGROUPMAN, /*deterministic=*/false, GetCheckRatio(m_node));
258258

259-
// add ipv4 address to the new table
260259
CNetAddr source = ResolveIP("252.2.2.2");
261-
CService addr1 = ResolveService("250.1.1.3", 8333);
262-
BOOST_CHECK(addrman->Add({CAddress(addr1, NODE_NONE)}, source));
263260

264261
// add I2P address to the tried table
265262
CAddress i2p_addr;
266263
i2p_addr.SetSpecial("udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.i2p");
267264
BOOST_CHECK(addrman->Add({i2p_addr}, source));
268265
BOOST_CHECK(addrman->Good(i2p_addr));
269266

267+
// add ipv4 address to the new table
268+
CService addr1 = ResolveService("250.1.1.3", 8333);
269+
BOOST_CHECK(addrman->Add({CAddress(addr1, NODE_NONE)}, source));
270+
270271
// since the only ipv4 address is on the new table, ensure that the new
271272
// table gets selected even if new_only is false. if the table was being
272273
// selected at random, this test will sporadically fail

0 commit comments

Comments
 (0)