Skip to content

Commit 5825b34

Browse files
jonatackmzumsande
andcommitted
test: avoid non-determinism in asmap-addrman test
This is the same approach as for the addpeeraddress test in `test/functional/rpc_net.py` in commit 869f136. The probability of collision when adding an addrman entry is expected to be 1/2^16 = 1/65536 for an address from a different /16. This change hopes to avoid these collisions by adding 1 tried entry before adding 1 new table one, instead of 2 tried entries followed by 2 new entries, which appears to have caused a collision in the CI. To verify the regression test stills fails when expected: - git checkout 181a120 && git cherry-pick ef242f5 - recompile bitcoind - git checkout this branch and run test/functional/feature_asmap.py. Expected output: ``` AssertionError: Unexpected stderr bitcoind: ./addrman.h:739: void CAddrMan::Check() const: Assertion `false' failed. != ``` Co-authored-by: Martin Zumsande <[email protected]>
1 parent b7e3600 commit 5825b34

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/functional/feature_asmap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def set_test_params(self):
4242
self.extra_args = [["-checkaddrman=1"]] # Do addrman checks on all operations.
4343

4444
def fill_addrman(self, node_id):
45-
"""Add 2 tried addresses to the addrman, followed by 2 new addresses."""
46-
for addr, tried in [[0, True], [1, True], [2, False], [3, False]]:
45+
"""Add 1 tried address to the addrman, followed by 1 new address."""
46+
for addr, tried in [[0, True], [1, False]]:
4747
self.nodes[node_id].addpeeraddress(address=f"101.{addr}.0.0", tried=tried, port=8333)
4848

4949
def test_without_asmap_arg(self):
@@ -89,7 +89,7 @@ def test_asmap_interaction_with_addrman_containing_entries(self):
8989
self.restart_node(0, ["-asmap", "-checkaddrman=1"])
9090
with self.node.assert_debug_log(
9191
expected_msgs=[
92-
"Addrman checks started: new 2, tried 2, total 4",
92+
"Addrman checks started: new 1, tried 1, total 2",
9393
"Addrman checks completed successfully",
9494
]
9595
):

0 commit comments

Comments
 (0)