Skip to content

Commit ba54983

Browse files
committed
[test] Test that wallet transactions aren't rebroadcast before 12 hours
1 parent 00d44a5 commit ba54983

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/functional/wallet_resendwallettransactions.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,21 @@ def run_test(self):
4949
block.solve()
5050
node.submitblock(ToHex(block))
5151

52-
# Transaction should not be rebroadcast
5352
node.syncwithvalidationinterfacequeue()
54-
node.p2ps[1].sync_with_ping()
55-
assert_equal(node.p2ps[1].tx_invs_received[txid], 0)
53+
now = int(time.time())
54+
55+
# Transaction should not be rebroadcast within first 12 hours
56+
# Leave 2 mins for buffer
57+
twelve_hrs = 12 * 60 * 60
58+
two_min = 2 * 60
59+
node.setmocktime(now + twelve_hrs - two_min)
60+
time.sleep(2) # ensure enough time has passed for rebroadcast attempt to occur
61+
assert_equal(txid in node.p2ps[1].get_invs(), False)
5662

5763
self.log.info("Bump time & check that transaction is rebroadcast")
5864
# Transaction should be rebroadcast approximately 24 hours in the future,
5965
# but can range from 12-36. So bump 36 hours to be sure.
60-
rebroadcast_time = int(time.time()) + 36 * 60 * 60
61-
node.setmocktime(rebroadcast_time)
66+
node.setmocktime(now + 36 * 60 * 60)
6267
wait_until(lambda: node.p2ps[1].tx_invs_received[txid] >= 1, lock=mininode_lock)
6368

6469

0 commit comments

Comments
 (0)