aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_transactiontime_rescan.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/wallet_transactiontime_rescan.py')
-rwxr-xr-xtest/functional/wallet_transactiontime_rescan.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/test/functional/wallet_transactiontime_rescan.py b/test/functional/wallet_transactiontime_rescan.py
index 904013cdef..3386ecd599 100755
--- a/test/functional/wallet_transactiontime_rescan.py
+++ b/test/functional/wallet_transactiontime_rescan.py
@@ -5,8 +5,10 @@
"""Test transaction time during old block rescanning
"""
+import threading
import time
+from test_framework.authproxy import JSONRPCException
from test_framework.blocktools import COINBASE_MATURITY
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
@@ -196,14 +198,28 @@ class TransactionTimeRescanTest(BitcoinTestFramework):
minernode.createwallet("encrypted_wallet", blank=True, passphrase="passphrase", descriptors=False)
encrypted_wallet = minernode.get_wallet_rpc("encrypted_wallet")
- encrypted_wallet.walletpassphrase("passphrase", 1)
+ encrypted_wallet.walletpassphrase("passphrase", 99999)
encrypted_wallet.sethdseed(seed=hd_seed)
- batch = []
- batch.append(encrypted_wallet.walletpassphrase.get_request("passphrase", 3))
- batch.append(encrypted_wallet.rescanblockchain.get_request())
+ t = threading.Thread(target=encrypted_wallet.rescanblockchain)
- encrypted_wallet.batch(batch)
+ with minernode.assert_debug_log(expected_msgs=[f'Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)'], timeout=5):
+ t.start()
+
+ # set the passphrase timeout to 1 to test that the wallet remains unlocked during the rescan
+ minernode.cli("-rpcwallet=encrypted_wallet").walletpassphrase("passphrase", 1)
+
+ try:
+ minernode.cli("-rpcwallet=encrypted_wallet").walletlock()
+ except JSONRPCException as e:
+ assert e.error['code'] == -4 and "Error: the wallet is currently being used to rescan the blockchain for related transactions. Please call `abortrescan` before locking the wallet." in e.error['message']
+
+ try:
+ minernode.cli("-rpcwallet=encrypted_wallet").walletpassphrasechange("passphrase", "newpassphrase")
+ except JSONRPCException as e:
+ assert e.error['code'] == -4 and "Error: the wallet is currently being used to rescan the blockchain for related transactions. Please call `abortrescan` before changing the passphrase." in e.error['message']
+
+ t.join()
assert_equal(encrypted_wallet.getbalance(), temp_wallet.getbalance())