Skip to content

Commit a905ed1

Browse files
committed
test: refactor: use set_node_times helper in wallet_transactiontime_rescan.py
1 parent 681b25e commit a905ed1

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

test/functional/wallet_transactiontime_rescan.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from test_framework.blocktools import COINBASE_MATURITY
1111
from test_framework.test_framework import BitcoinTestFramework
1212
from test_framework.util import (
13-
assert_equal
13+
assert_equal,
14+
set_node_times,
1415
)
1516

1617

@@ -35,9 +36,7 @@ def run_test(self):
3536

3637
# synchronize nodes and time
3738
self.sync_all()
38-
minernode.setmocktime(cur_time)
39-
usernode.setmocktime(cur_time)
40-
restorenode.setmocktime(cur_time)
39+
set_node_times(self.nodes, cur_time)
4140

4241
# prepare miner wallet
4342
minernode.createwallet(wallet_name='default')
@@ -68,9 +67,7 @@ def run_test(self):
6867

6968
# synchronize nodes and time
7069
self.sync_all()
71-
minernode.setmocktime(cur_time + ten_days)
72-
usernode.setmocktime(cur_time + ten_days)
73-
restorenode.setmocktime(cur_time + ten_days)
70+
set_node_times(self.nodes, cur_time + ten_days)
7471
# send 10 btc to user's first watch-only address
7572
self.log.info('Send 10 btc to user')
7673
miner_wallet.sendtoaddress(wo1, 10)
@@ -81,9 +78,7 @@ def run_test(self):
8178

8279
# synchronize nodes and time
8380
self.sync_all()
84-
minernode.setmocktime(cur_time + ten_days + ten_days)
85-
usernode.setmocktime(cur_time + ten_days + ten_days)
86-
restorenode.setmocktime(cur_time + ten_days + ten_days)
81+
set_node_times(self.nodes, cur_time + ten_days + ten_days)
8782
# send 5 btc to our second watch-only address
8883
self.log.info('Send 5 btc to user')
8984
miner_wallet.sendtoaddress(wo2, 5)
@@ -94,9 +89,7 @@ def run_test(self):
9489

9590
# synchronize nodes and time
9691
self.sync_all()
97-
minernode.setmocktime(cur_time + ten_days + ten_days + ten_days)
98-
usernode.setmocktime(cur_time + ten_days + ten_days + ten_days)
99-
restorenode.setmocktime(cur_time + ten_days + ten_days + ten_days)
92+
set_node_times(self.nodes, cur_time + ten_days + ten_days + ten_days)
10093
# send 1 btc to our third watch-only address
10194
self.log.info('Send 1 btc to user')
10295
miner_wallet.sendtoaddress(wo3, 1)

0 commit comments

Comments
 (0)