diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-10-22 14:11:47 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-10-22 14:18:06 +0200 |
commit | 88271184e82222f556d67511cc64230b0532f40d (patch) | |
tree | ea570670699a3a96b1e2046a186f4c69cb90cd55 /test | |
parent | 7012db2a6bcd38cc820771fc9fd7fef13772ea32 (diff) | |
parent | fa299ac27364bd7a59e6fb7e0c4ce476f2deec40 (diff) |
Merge #20112: test: Speed up wallet_resendwallettransactions with mockscheduler RPC
fa299ac27364bd7a59e6fb7e0c4ce476f2deec40 test: Speed up wallet_resendwallettransactions test with mockscheduler RPC (MarcoFalke)
Pull request description:
Also fixes #20143
ACKs for top commit:
guggero:
ACK fa299ac2
Tree-SHA512: 024ced4aa5f5c266e24fd0583d47b45b19c2a6ae25a06fabeacaa0ac996eec0c45f11cc34b2df17d01759b78ed31a991aa86978aafcc76cb0017382f601bf85a
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/wallet_resendwallettransactions.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/functional/wallet_resendwallettransactions.py b/test/functional/wallet_resendwallettransactions.py index 1dcb12de08..353deefcc1 100755 --- a/test/functional/wallet_resendwallettransactions.py +++ b/test/functional/wallet_resendwallettransactions.py @@ -11,6 +11,7 @@ from test_framework.p2p import P2PTxInvStore from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal + class ResendWalletTransactionsTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 @@ -27,10 +28,10 @@ class ResendWalletTransactionsTest(BitcoinTestFramework): txid = node.sendtoaddress(node.getnewaddress(), 1) # Wallet rebroadcast is first scheduled 1 sec after startup (see - # nNextResend in ResendWalletTransactions()). Sleep for just over a - # second to be certain that it has been called before the first + # nNextResend in ResendWalletTransactions()). Tell scheduler to call + # MaybeResendWalletTxn now to initialize nNextResend before the first # setmocktime call below. - time.sleep(1.1) + node.mockscheduler(1) # Can take a few seconds due to transaction trickling peer_first.wait_for_broadcast([txid]) @@ -57,15 +58,16 @@ class ResendWalletTransactionsTest(BitcoinTestFramework): 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 + node.mockscheduler(1) # Tell scheduler to call MaybeResendWalletTxn now assert_equal(int(txid, 16) in peer_second.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. - node.setmocktime(now + 36 * 60 * 60) - # Tell scheduler to call MaybeResendWalletTxn now. - node.mockscheduler(1) + with node.assert_debug_log(['ResendWalletTransactions: resubmit 1 unconfirmed transactions']): + node.setmocktime(now + 36 * 60 * 60) + # Tell scheduler to call MaybeResendWalletTxn now. + node.mockscheduler(1) # Give some time for trickle to occur node.setmocktime(now + 36 * 60 * 60 + 600) peer_second.wait_for_broadcast([txid]) |