aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_resendwallettransactions.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/wallet_resendwallettransactions.py')
-rwxr-xr-xtest/functional/wallet_resendwallettransactions.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/functional/wallet_resendwallettransactions.py b/test/functional/wallet_resendwallettransactions.py
index 0327c9e070..1dcb12de08 100755
--- a/test/functional/wallet_resendwallettransactions.py
+++ b/test/functional/wallet_resendwallettransactions.py
@@ -21,7 +21,7 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
def run_test(self):
node = self.nodes[0] # alias
- node.add_p2p_connection(P2PTxInvStore())
+ peer_first = node.add_p2p_connection(P2PTxInvStore())
self.log.info("Create a new transaction and wait until it's broadcast")
txid = node.sendtoaddress(node.getnewaddress(), 1)
@@ -33,10 +33,10 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
time.sleep(1.1)
# Can take a few seconds due to transaction trickling
- node.p2p.wait_for_broadcast([txid])
+ peer_first.wait_for_broadcast([txid])
# Add a second peer since txs aren't rebroadcast to the same peer (see filterInventoryKnown)
- node.add_p2p_connection(P2PTxInvStore())
+ peer_second = node.add_p2p_connection(P2PTxInvStore())
self.log.info("Create a block")
# Create and submit a block without the transaction.
@@ -58,13 +58,17 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
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(int(txid, 16) in node.p2ps[1].get_invs(), False)
+ 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)
- node.p2p.wait_for_broadcast([txid])
+ # 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])
if __name__ == '__main__':