Skip to content

Commit

Permalink
test: fix intermittent failures with test=addrman
Browse files Browse the repository at this point in the history
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 <b10c@b10c.me>
  • Loading branch information
mzumsande and 0xB10C committed Mar 12, 2024
1 parent bde3db4 commit 432a542
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/functional/feature_asmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
4 changes: 3 additions & 1 deletion test/functional/rpc_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 432a542

Please sign in to comment.