From 432a542e271f5b6ecb1c6ea4fa9108ad4b3a5a43 Mon Sep 17 00:00:00 2001 From: Martin Zumsande Date: Tue, 12 Mar 2024 14:00:23 -0400 Subject: [PATCH] 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 --- test/functional/feature_asmap.py | 3 ++- test/functional/rpc_net.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/functional/feature_asmap.py b/test/functional/feature_asmap.py index 7e32f8d515b2d..024a8fa18c063 100755 --- a/test/functional/feature_asmap.py +++ b/test/functional/feature_asmap.py @@ -39,7 +39,8 @@ def expected_messages(filename): class AsmapTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 - self.extra_args = [["-checkaddrman=1"]] # Do addrman checks on all operations. + # Do addrman checks on all operations and use deterministic addrman + self.extra_args = [["-checkaddrman=1", "-test=addrman"]] def fill_addrman(self, node_id): """Add 2 tried addresses to the addrman, followed by 2 new addresses.""" diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py index 265d9d959ae4b..22789644f2733 100755 --- a/test/functional/rpc_net.py +++ b/test/functional/rpc_net.py @@ -319,7 +319,9 @@ def test_getnodeaddresses(self): def test_addpeeraddress(self): self.log.info("Test addpeeraddress") - self.restart_node(1, ["-checkaddrman=1", "-test=addrman"]) + # The node has an existing, non-deterministic addrman from a previous test. + # Clear it to have a deterministic addrman. + self.restart_node(1, ["-checkaddrman=1", "-test=addrman"], clear_addrman=True) node = self.nodes[1] self.log.debug("Test that addpeerinfo is a hidden RPC")