diff options
author | Andrew Chow <github@achow101.com> | 2023-06-30 13:20:25 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-06-30 13:29:04 -0400 |
commit | 6744d840dfa30a45e0a0786932b206cf133556d4 (patch) | |
tree | aa082245a5dafa345180ab9eb336c39cb4907056 /src/test/addrman_tests.cpp | |
parent | a8bd0fef25221c8b40345112eaf1d532e1a6ee26 (diff) | |
parent | cd8ef5b3e66b3f766c9c883259b5feb44540d7df (diff) |
Merge bitcoin/bitcoin#27745: addrman: select addresses by network follow-up
cd8ef5b3e66b3f766c9c883259b5feb44540d7df test: ensure addrman test is finite (Amiti Uttarwar)
b9f1e86f129e46bb5770fb421d0ba164b5c7aaf8 addrman: change asserts to Assumes (Amiti Uttarwar)
768770771f7db60147943152b34a8dd485cdcc76 doc: update `Select` function description (Amiti Uttarwar)
2b6bd12eea0c970881753124ec3f0a67e2de8e17 refactor: de-duplicate lookups (Amiti Uttarwar)
Pull request description:
this PR addresses outstanding review comments from #27214
ACKs for top commit:
achow101:
ACK cd8ef5b3e66b3f766c9c883259b5feb44540d7df
mzumsande:
Code Review ACK cd8ef5b3e66b3f766c9c883259b5feb44540d7df
brunoerg:
crACK cd8ef5b3e66b3f766c9c883259b5feb44540d7df
Tree-SHA512: 669f67904263e3f51c39b175eabf5fa1b1e7b6841e889656afec33d0bd93fb446de9403f0a91b186ddeaf29498c8938484a0547b1188256c4e7c90db6f30bb55
Diffstat (limited to 'src/test/addrman_tests.cpp')
-rw-r--r-- | src/test/addrman_tests.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/addrman_tests.cpp b/src/test/addrman_tests.cpp index 328e7f81a0..c02322ec7d 100644 --- a/src/test/addrman_tests.cpp +++ b/src/test/addrman_tests.cpp @@ -239,8 +239,9 @@ BOOST_AUTO_TEST_CASE(addrman_select_by_network) // ensure that both new and tried table are selected from bool new_selected{false}; bool tried_selected{false}; + int counter = 256; - while (!new_selected || !tried_selected) { + while (--counter > 0 && (!new_selected || !tried_selected)) { const CAddress selected{addrman->Select(/*new_only=*/false, NET_I2P).first}; BOOST_REQUIRE(selected == i2p_addr || selected == i2p_addr2); if (selected == i2p_addr) { @@ -249,6 +250,9 @@ BOOST_AUTO_TEST_CASE(addrman_select_by_network) new_selected = true; } } + + BOOST_CHECK(new_selected); + BOOST_CHECK(tried_selected); } BOOST_AUTO_TEST_CASE(addrman_select_special) |