Skip to content

Commit 49d07ea

Browse files
committed
Merge bitcoin/bitcoin#27506: test: prevent intermittent failures
10a354f test: prevent intermittent failures (Amiti Uttarwar) Pull request description: Follow up to #27214 - add an address to the tried table before the new table to make sure a new table collision is not possible. ACKs for top commit: mzumsande: Code review ACK 10a354f - the fix is what I suggested [here](bitcoin/bitcoin#27214 (comment)) and should make these intermittent failures impossible. Tree-SHA512: 24099f02e1915395130065af0ef6a2a1893955d222517d156d928765541d9c427da00172a9b5a540163f4d6aae93ca3882e8267eeb35ecc595d42178abc6191c
2 parents 2755aa5 + 10a354f commit 49d07ea

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)