Merge bitcoin/bitcoin#29639: test: fix intermittent failures with test=addrman

432a542e27 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](432a542e27)
  stratospher:
    Tested ACK 432a542e27.
  brunoerg:
    crACK 432a542e27
  0xB10C:
    ACK 432a542e27

Tree-SHA512: a8e284baeb0be2df7284b8a2792cb9edc9e2d5b877a3b29ab7277ffdb75b17efa58a4d42576441eb493cd518e7c5ffdb05597b27e42b5001cf1a80e78bb04c83
This commit is contained in:
fanquake 2024-03-19 13:49:49 +00:00
commit 9f2609de09
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1
2 changed files with 5 additions and 2 deletions

View File

@ -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."""

View File

@ -319,7 +319,9 @@ class NetTest(BitcoinTestFramework):
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")