Skip to content

Commit

Permalink
Merge bitcoin#29639: test: fix intermittent failures with test=addrman
Browse files Browse the repository at this point in the history
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 bitcoin#29634

ACKs for top commit:
  kevkevinpal:
    ACK [432a542](bitcoin@432a542)
  stratospher:
    Tested ACK 432a542.
  brunoerg:
    crACK 432a542
  0xB10C:
    ACK 432a542

Tree-SHA512: a8e284baeb0be2df7284b8a2792cb9edc9e2d5b877a3b29ab7277ffdb75b17efa58a4d42576441eb493cd518e7c5ffdb05597b27e42b5001cf1a80e78bb04c83
  • Loading branch information
fanquake committed Mar 19, 2024
2 parents 0f89e86 + 432a542 commit 9f2609d
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 9f2609d

Please sign in to comment.