diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 35cab8f6ec..24740e3011 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -178,7 +178,8 @@ BASE_SCRIPTS = [ 'rpc_rawtransaction.py --legacy-wallet', 'rpc_rawtransaction.py --descriptors', 'wallet_groups.py --legacy-wallet', - 'wallet_transactiontime_rescan.py', + 'wallet_transactiontime_rescan.py --descriptors', + 'wallet_transactiontime_rescan.py --legacy-wallet', 'p2p_addrv2_relay.py', 'wallet_groups.py --descriptors', 'p2p_compactblocks_hb.py', diff --git a/test/functional/wallet_transactiontime_rescan.py b/test/functional/wallet_transactiontime_rescan.py index d26d1b9bfa..21941084a3 100755 --- a/test/functional/wallet_transactiontime_rescan.py +++ b/test/functional/wallet_transactiontime_rescan.py @@ -10,7 +10,8 @@ import time from test_framework.blocktools import COINBASE_MATURITY from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( - assert_equal + assert_equal, + set_node_times, ) @@ -35,9 +36,7 @@ class TransactionTimeRescanTest(BitcoinTestFramework): # synchronize nodes and time self.sync_all() - minernode.setmocktime(cur_time) - usernode.setmocktime(cur_time) - restorenode.setmocktime(cur_time) + set_node_times(self.nodes, cur_time) # prepare miner wallet minernode.createwallet(wallet_name='default') @@ -68,9 +67,7 @@ class TransactionTimeRescanTest(BitcoinTestFramework): # synchronize nodes and time self.sync_all() - minernode.setmocktime(cur_time + ten_days) - usernode.setmocktime(cur_time + ten_days) - restorenode.setmocktime(cur_time + ten_days) + set_node_times(self.nodes, cur_time + ten_days) # send 10 btc to user's first watch-only address self.log.info('Send 10 btc to user') miner_wallet.sendtoaddress(wo1, 10) @@ -81,9 +78,7 @@ class TransactionTimeRescanTest(BitcoinTestFramework): # synchronize nodes and time self.sync_all() - minernode.setmocktime(cur_time + ten_days + ten_days) - usernode.setmocktime(cur_time + ten_days + ten_days) - restorenode.setmocktime(cur_time + ten_days + ten_days) + set_node_times(self.nodes, cur_time + ten_days + ten_days) # send 5 btc to our second watch-only address self.log.info('Send 5 btc to user') miner_wallet.sendtoaddress(wo2, 5) @@ -94,9 +89,7 @@ class TransactionTimeRescanTest(BitcoinTestFramework): # synchronize nodes and time self.sync_all() - minernode.setmocktime(cur_time + ten_days + ten_days + ten_days) - usernode.setmocktime(cur_time + ten_days + ten_days + ten_days) - restorenode.setmocktime(cur_time + ten_days + ten_days + ten_days) + set_node_times(self.nodes, cur_time + ten_days + ten_days + ten_days) # send 1 btc to our third watch-only address self.log.info('Send 1 btc to user') miner_wallet.sendtoaddress(wo3, 1) @@ -126,6 +119,14 @@ class TransactionTimeRescanTest(BitcoinTestFramework): restorenode.createwallet(wallet_name='wo', disable_private_keys=True) restorewo_wallet = restorenode.get_wallet_rpc('wo') + # for descriptor wallets, the test framework maps the importaddress RPC to the + # importdescriptors RPC (with argument 'timestamp'='now'), which always rescans + # blocks of the past 2 hours, based on the current MTP timestamp; in order to avoid + # importing the last address (wo3), we advance the time further and generate 10 blocks + if self.options.descriptors: + set_node_times(self.nodes, cur_time + ten_days + ten_days + ten_days + ten_days) + self.generatetoaddress(minernode, 10, m1) + restorewo_wallet.importaddress(wo1, rescan=False) restorewo_wallet.importaddress(wo2, rescan=False) restorewo_wallet.importaddress(wo3, rescan=False)