diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2020-04-28 10:20:16 -0700 |
---|---|---|
committer | Amiti Uttarwar <amiti@uttarwar.org> | 2020-05-25 11:27:06 -0700 |
commit | ba5498318233ab81decbc585e9619d8ffe2df1b0 (patch) | |
tree | 792df3523626f6328d0dff7b5a1a64f02408066d | |
parent | 00d44a534b4e5ae249b8011360c6b0f7dc731581 (diff) | |
download | bitcoin-ba5498318233ab81decbc585e9619d8ffe2df1b0.tar.xz |
[test] Test that wallet transactions aren't rebroadcast before 12 hours
-rwxr-xr-x | test/functional/wallet_resendwallettransactions.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/functional/wallet_resendwallettransactions.py b/test/functional/wallet_resendwallettransactions.py index b384998d56..3417616d77 100755 --- a/test/functional/wallet_resendwallettransactions.py +++ b/test/functional/wallet_resendwallettransactions.py @@ -49,16 +49,21 @@ class ResendWalletTransactionsTest(BitcoinTestFramework): block.solve() node.submitblock(ToHex(block)) - # Transaction should not be rebroadcast node.syncwithvalidationinterfacequeue() - node.p2ps[1].sync_with_ping() - assert_equal(node.p2ps[1].tx_invs_received[txid], 0) + now = int(time.time()) + + # Transaction should not be rebroadcast within first 12 hours + # Leave 2 mins for buffer + twelve_hrs = 12 * 60 * 60 + two_min = 2 * 60 + node.setmocktime(now + twelve_hrs - two_min) + time.sleep(2) # ensure enough time has passed for rebroadcast attempt to occur + assert_equal(txid in node.p2ps[1].get_invs(), False) self.log.info("Bump time & check that transaction is rebroadcast") # Transaction should be rebroadcast approximately 24 hours in the future, # but can range from 12-36. So bump 36 hours to be sure. - rebroadcast_time = int(time.time()) + 36 * 60 * 60 - node.setmocktime(rebroadcast_time) + node.setmocktime(now + 36 * 60 * 60) wait_until(lambda: node.p2ps[1].tx_invs_received[txid] >= 1, lock=mininode_lock) |