Skip to content

Commit 432a542

Browse files
mzumsande0xB10C
andcommitted
test: fix intermittent failures with test=addrman
The nKey of the addrman is generated the first time the node is started. Therefore, restarting a node or turning it off and on again won't make a previously non-deterministic addrman deterministic. Co-authored-by: 0xb10c <[email protected]>
1 parent bde3db4 commit 432a542

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

test/functional/feature_asmap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def expected_messages(filename):
3939
class AsmapTest(BitcoinTestFramework):
4040
def set_test_params(self):
4141
self.num_nodes = 1
42-
self.extra_args = [["-checkaddrman=1"]] # Do addrman checks on all operations.
42+
# Do addrman checks on all operations and use deterministic addrman
43+
self.extra_args = [["-checkaddrman=1", "-test=addrman"]]
4344

4445
def fill_addrman(self, node_id):
4546
"""Add 2 tried addresses to the addrman, followed by 2 new addresses."""

test/functional/rpc_net.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ def test_getnodeaddresses(self):
319319

320320
def test_addpeeraddress(self):
321321
self.log.info("Test addpeeraddress")
322-
self.restart_node(1, ["-checkaddrman=1", "-test=addrman"])
322+
# The node has an existing, non-deterministic addrman from a previous test.
323+
# Clear it to have a deterministic addrman.
324+
self.restart_node(1, ["-checkaddrman=1", "-test=addrman"], clear_addrman=True)
323325
node = self.nodes[1]
324326

325327
self.log.debug("Test that addpeerinfo is a hidden RPC")

0 commit comments

Comments
 (0)