diff --git a/test/functional/mempool_unbroadcast.py b/test/functional/mempool_unbroadcast.py --- a/test/functional/mempool_unbroadcast.py +++ b/test/functional/mempool_unbroadcast.py @@ -16,6 +16,9 @@ disconnect_nodes, ) +# 15 minutes in seconds +MAX_INITIAL_BROADCAST_DELAY = 15 * 60 + class MempoolUnbroadcastTest(BitcoinTestFramework): def set_test_params(self): @@ -75,7 +78,7 @@ # fast forward into the future & ensure that the second node has the # txns - node.mockscheduler(15 * 60) # 15 min in seconds + node.mockscheduler(MAX_INITIAL_BROADCAST_DELAY) self.sync_mempools(timeout=30) mempool = self.nodes[1].getrawmempool() assert rpc_tx_hsh in mempool @@ -90,16 +93,18 @@ "Add another connection & ensure transactions aren't broadcast again") conn = node.add_p2p_connection(P2PTxInvStore()) - node.mockscheduler(15 * 60) - time.sleep(5) + node.mockscheduler(MAX_INITIAL_BROADCAST_DELAY) + # allow sufficient time for possibility of broadcast + time.sleep(2) assert_equal(len(conn.get_invs()), 0) + disconnect_nodes(node, self.nodes[1]) + node.disconnect_p2ps() + def test_txn_removal(self): self.log.info( "Test that transactions removed from mempool are removed from unbroadcast set") node = self.nodes[0] - disconnect_nodes(node, self.nodes[1]) - node.disconnect_p2ps() # since the node doesn't have any connections, it will not receive # any GETDATAs & thus the transaction will remain in the unbroadcast