Skip to content

Commit 2706c5b

Browse files
committed
test: test_inv_block, use mocktime instead of waiting
1 parent d6c229d commit 2706c5b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/functional/p2p_tx_download.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ def test_inv_block(self):
105105
tx = self.wallet.create_self_transfer()
106106
wtxid = int(tx['wtxid'], 16)
107107

108+
self.nodes[0].setmocktime(int(time.time()))
109+
108110
self.log.info(
109111
"Announce the transaction to all nodes from all {} incoming peers, but never send it".format(NUM_INBOUND))
110112
msg = msg_inv([CInv(t=MSG_WTX, h=wtxid)])
@@ -125,7 +127,10 @@ def test_inv_block(self):
125127
assert self.nodes[1].getpeerinfo()[0]['inbound'] == False
126128
timeout = 2 + INBOUND_PEER_TX_DELAY + GETDATA_TX_INTERVAL
127129
self.log.info("Tx should be received at node 1 after {} seconds".format(timeout))
128-
self.sync_mempools(timeout=timeout)
130+
self.nodes[0].bumpmocktime(timeout)
131+
self.sync_mempools()
132+
133+
self.nodes[0].setmocktime(0)
129134

130135
def test_in_flight_max(self):
131136
self.log.info("Test that we don't load peers with more than {} transaction requests immediately".format(MAX_GETDATA_IN_FLIGHT))

0 commit comments

Comments
 (0)