Skip to content

Commit 2d5acc9

Browse files
committed
Merge bitcoin/bitcoin#27015: p2p: 26847 fixups (AddrMan totals)
dc70c1e addrman: Use std::nullopt instead of {} (Martin Zumsande) 59cc66a test: Remove AddrMan unit test that fails consistency checks (Martin Zumsande) Pull request description: Two fixups for #26847: * Now that `AddrMan::Size()` performs internal consistency tests (it didn't before), we can't call it in the `load_addrman_corrupted` unit tests, where we deal with an artificially corrupted `AddrMan`. This would fail the test when using `-checkaddrman=1` (leading to spurious CI fails). Therefore remove the tests assertion, which is not particularly helpful anyway (in production we abort init when peers.dat is corrupted instead of querying AddrMan in its corrupted state). (See bitcoin/bitcoin#26847 (comment)) * Use `std::nullopt` instead of `{}` for default args (suggested in bitcoin/bitcoin#26847 (comment)) ACKs for top commit: MarcoFalke: lgtm ACK dc70c1e Tree-SHA512: dd8a988e23d71a66d3dd30560bb653c9ad17db6915abfa5f722818b0ab18921051ec9223bfbc75d967df8bcd204dfe473d680bf68e8a8e4e4998fbb91dc973c5
2 parents 550e6bd + dc70c1e commit 2d5acc9

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

src/addrman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class AddrMan
106106
* @param[in] in_new Select addresses only from one table (true = new, false = tried, nullopt = both)
107107
* @return Number of unique addresses that match specified options.
108108
*/
109-
size_t Size(std::optional<Network> net = {}, std::optional<bool> in_new = {}) const;
109+
size_t Size(std::optional<Network> net = std::nullopt, std::optional<bool> in_new = std::nullopt) const;
110110

111111
/**
112112
* Attempt to add one or more addresses to addrman's new table.

src/test/addrman_tests.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -947,8 +947,6 @@ BOOST_AUTO_TEST_CASE(load_addrman_corrupted)
947947
} catch (const std::exception&) {
948948
exceptionThrown = true;
949949
}
950-
// Even though de-serialization failed addrman is not left in a clean state.
951-
BOOST_CHECK(addrman1.Size() == 1);
952950
BOOST_CHECK(exceptionThrown);
953951

954952
// Test that ReadFromStream fails if peers.dat is corrupt

0 commit comments

Comments
 (0)