aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAmiti Uttarwar <amiti@uttarwar.org>2020-04-28 10:20:16 -0700
committerAmiti Uttarwar <amiti@uttarwar.org>2020-05-25 11:27:06 -0700
commitba5498318233ab81decbc585e9619d8ffe2df1b0 (patch)
tree792df3523626f6328d0dff7b5a1a64f02408066d /test
parent00d44a534b4e5ae249b8011360c6b0f7dc731581 (diff)
[test] Test that wallet transactions aren't rebroadcast before 12 hours
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet_resendwallettransactions.py15
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)