aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2020-09-27 14:43:27 -0700
committerPieter Wuille <pieter@wuille.net>2020-10-08 01:04:29 -0700
commitec3916f40a3fc644ecbbaaddef6258937c7fcfbc (patch)
treebba4bbe9983387cafb8f4a1873d2e3e3516dce7c /test/functional
parent283a73d7eaea2907a6f7f800f529a0d6db53d7a6 (diff)
Use mockable time everywhere in net_processing
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/p2p_tx_download.py30
-rwxr-xr-xtest/functional/wallet_resendwallettransactions.py4
2 files changed, 17 insertions, 17 deletions
diff --git a/test/functional/p2p_tx_download.py b/test/functional/p2p_tx_download.py
index 653c7ae43f..5c3f021b3f 100755
--- a/test/functional/p2p_tx_download.py
+++ b/test/functional/p2p_tx_download.py
@@ -158,23 +158,19 @@ class TxDownloadTest(BitcoinTestFramework):
self.nodes[0].p2ps[0].send_message(msg_notfound(vec=[CInv(MSG_TX, 1)]))
def run_test(self):
- # Setup the p2p connections
- self.peers = []
- for node in self.nodes:
- for _ in range(NUM_INBOUND):
- self.peers.append(node.add_p2p_connection(TestP2PConn()))
-
- self.log.info("Nodes are setup with {} incoming connections each".format(NUM_INBOUND))
-
- self.test_spurious_notfound()
-
- # Test the in-flight max first, because we want no transactions in
- # flight ahead of this test.
- self.test_in_flight_max()
-
- self.test_inv_block()
-
- self.test_tx_requests()
+ # Run each test against new bitcoind instances, as setting mocktimes has long-term effects on when
+ # the next trickle relay event happens.
+ for test in [self.test_spurious_notfound, self.test_in_flight_max, self.test_inv_block, self.test_tx_requests]:
+ self.stop_nodes()
+ self.start_nodes()
+ self.connect_nodes(1, 0)
+ # Setup the p2p connections
+ self.peers = []
+ for node in self.nodes:
+ for _ in range(NUM_INBOUND):
+ self.peers.append(node.add_p2p_connection(TestP2PConn()))
+ self.log.info("Nodes are setup with {} incoming connections each".format(NUM_INBOUND))
+ test()
if __name__ == '__main__':
diff --git a/test/functional/wallet_resendwallettransactions.py b/test/functional/wallet_resendwallettransactions.py
index d3c03c4764..1dcb12de08 100755
--- a/test/functional/wallet_resendwallettransactions.py
+++ b/test/functional/wallet_resendwallettransactions.py
@@ -64,6 +64,10 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
# 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)
+ # Give some time for trickle to occur
+ node.setmocktime(now + 36 * 60 * 60 + 600)
peer_second.wait_for_broadcast([txid])