Skip to content

Commit 9f2609d

Browse files
committed
Merge bitcoin/bitcoin#29639: test: fix intermittent failures with test=addrman
432a542 test: fix intermittent failures with test=addrman (Martin Zumsande) Pull request description: The `nKey` of the addrman is generated the first time the node is started with an empty `peers.dat`. Therefore, restarting a node or turning it off and on again won't make a previously non-deterministic addrman deterministic. This could lead to intermittent failures in `feature_asmap.py` and `rpc_net.py` Fixes #29634 ACKs for top commit: kevkevinpal: ACK [432a542](bitcoin/bitcoin@432a542) stratospher: Tested ACK 432a542. brunoerg: crACK 432a542 0xB10C: ACK 432a542 Tree-SHA512: a8e284baeb0be2df7284b8a2792cb9edc9e2d5b877a3b29ab7277ffdb75b17efa58a4d42576441eb493cd518e7c5ffdb05597b27e42b5001cf1a80e78bb04c83
2 parents 0f89e86 + 432a542 commit 9f2609d

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)