Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_resendwallettransactions.py
Show All 35 Lines | class ResendWalletTransactionsTest(BitcoinTestFramework): | ||||
def run_test(self): | def run_test(self): | ||||
node = self.nodes[0] # alias | node = self.nodes[0] # alias | ||||
node.add_p2p_connection(P2PStoreTxInvs()) | node.add_p2p_connection(P2PStoreTxInvs()) | ||||
self.log.info("Create a new transaction and wait until it's broadcast") | self.log.info("Create a new transaction and wait until it's broadcast") | ||||
txid = int(node.sendtoaddress(node.getnewaddress(), 1), 16) | txid = int(node.sendtoaddress(node.getnewaddress(), 1), 16) | ||||
# 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 | |||||
# setmocktime call below. | |||||
time.sleep(1.1) | |||||
# Can take a few seconds due to transaction trickling | # Can take a few seconds due to transaction trickling | ||||
wait_until( | wait_until( | ||||
lambda: node.p2p.tx_invs_received[txid] >= 1, | lambda: node.p2p.tx_invs_received[txid] >= 1, | ||||
lock=mininode_lock) | lock=mininode_lock) | ||||
# Add a second peer since txs aren't rebroadcast to the same peer (see | # Add a second peer since txs aren't rebroadcast to the same peer (see | ||||
# filterInventoryKnown) | # filterInventoryKnown) | ||||
node.add_p2p_connection(P2PStoreTxInvs()) | node.add_p2p_connection(P2PStoreTxInvs()) | ||||
Show All 30 Lines |