On some CI runs, the timer in ThreadOpenConnection was only started *after*
the mocktime was set. Fix this by waiting for the first connection attempt,
which happens after the timer was started.
Also convert some comments into log messages/add a log, so that the test
isn't completely silent.
@ -20,17 +20,18 @@ class P2PSeedNodes(BitcoinTestFramework):
self.disable_autoconnect=False
deftest_no_seednode(self):
# Check that if no seednode is provided, the node proceeds as usual (without waiting)
self.log.info("Check that if no seednode is provided, the node proceeds as usual (without waiting)")
withself.nodes[0].assert_debug_log(expected_msgs=[],unexpected_msgs=["Empty addrman, adding seednode",f"Couldn't connect to peers from addrman after {ADD_NEXT_SEEDNODE} seconds. Adding seednode"],timeout=ADD_NEXT_SEEDNODE):
self.restart_node(0)
deftest_seednode_empty_addrman(self):
seed_node="0.0.0.1"
# Check that the seednode is added to m_addr_fetches on bootstrap on an empty addrman
self.log.info("Check that the seednode is immediately added on bootstrap on an empty addrman")
withself.nodes[0].assert_debug_log(expected_msgs=[f"Empty addrman, adding seednode ({seed_node}) to addrfetch"],timeout=ADD_NEXT_SEEDNODE):
self.log.info("Check that if addrman is non-empty, seednodes are queried with a delay")
seed_node="0.0.0.2"
node=self.nodes[0]
# Fill the addrman with unreachable nodes
@ -40,8 +41,10 @@ class P2PSeedNodes(BitcoinTestFramework):
node.addpeeraddress(ip,port)
# Restart the node so seednode is processed again
withnode.assert_debug_log(expected_msgs=[f"Couldn't connect to peers from addrman after {ADD_NEXT_SEEDNODE} seconds. Adding seednode ({seed_node}) to addrfetch"],unexpected_msgs=["Empty addrman, adding seednode"],timeout=ADD_NEXT_SEEDNODE*1.5):
withnode.assert_debug_log(expected_msgs=[f"Couldn't connect to peers from addrman after {ADD_NEXT_SEEDNODE} seconds. Adding seednode ({seed_node}) to addrfetch"],unexpected_msgs=["Empty addrman, adding seednode"],timeout=ADD_NEXT_SEEDNODE*1.5):