test: remove legacy wallet functional tests
Removes all legacy wallet specific functional tests. Also removes the --descriptor and --legacy-wallet options as these are no longer necessary with the legacy wallet removed.
This commit is contained in:
1 parent
20a9173717
commit
c847dee148
96 files changed
+389
-4669
No files matched your search
@@ -5,10 +5,8 @@
|
||||
"""Test transaction time during old block rescanning
|
||||
"""
|
||||
|
||||
import concurrent.futures
|
||||
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 (
|
||||
@@ -16,15 +14,9 @@ from test_framework.util import (
|
||||
assert_raises_rpc_error,
|
||||
set_node_times,
|
||||
)
|
||||
from test_framework.wallet_util import (
|
||||
get_generate_key,
|
||||
)
|
||||
|
||||
|
||||
class TransactionTimeRescanTest(BitcoinTestFramework):
|
||||
def add_options(self, parser):
|
||||
self.add_wallet_options(parser)
|
||||
|
||||
def set_test_params(self):
|
||||
self.setup_clean_chain = False
|
||||
self.num_nodes = 3
|
||||
@@ -136,9 +128,8 @@ class TransactionTimeRescanTest(BitcoinTestFramework):
|
||||
# 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)
|
||||
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)
|
||||
@@ -181,46 +172,6 @@ class TransactionTimeRescanTest(BitcoinTestFramework):
|
||||
enc_wallet = usernode.get_wallet_rpc("enc_wallet")
|
||||
assert_raises_rpc_error(-13, "Error: Please enter the wallet passphrase with walletpassphrase first.", enc_wallet.rescanblockchain)
|
||||
|
||||
if not self.options.descriptors:
|
||||
self.log.info("Test rescanning an encrypted wallet")
|
||||
hd_seed = get_generate_key().privkey
|
||||
|
||||
usernode.createwallet(wallet_name="temp_wallet", blank=True, descriptors=False)
|
||||
temp_wallet = usernode.get_wallet_rpc("temp_wallet")
|
||||
temp_wallet.sethdseed(seed=hd_seed)
|
||||
|
||||
for i in range(399):
|
||||
temp_wallet.getnewaddress()
|
||||
|
||||
self.generatetoaddress(usernode, COINBASE_MATURITY + 1, temp_wallet.getnewaddress())
|
||||
self.generatetoaddress(usernode, COINBASE_MATURITY + 1, temp_wallet.getnewaddress())
|
||||
|
||||
minernode.createwallet("encrypted_wallet", blank=True, passphrase="passphrase", descriptors=False)
|
||||
encrypted_wallet = minernode.get_wallet_rpc("encrypted_wallet")
|
||||
|
||||
encrypted_wallet.walletpassphrase("passphrase", 99999)
|
||||
encrypted_wallet.sethdseed(seed=hd_seed)
|
||||
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as thread:
|
||||
with minernode.assert_debug_log(expected_msgs=["Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)"], timeout=5):
|
||||
rescanning = thread.submit(encrypted_wallet.rescanblockchain)
|
||||
|
||||
# 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"]
|
||||
|
||||
assert_equal(rescanning.result(), {"start_height": 0, "stop_height": 803})
|
||||
|
||||
assert_equal(encrypted_wallet.getbalance(), temp_wallet.getbalance())
|
||||
|
||||
if __name__ == '__main__':
|
||||
TransactionTimeRescanTest(__file__).main()
|
||||
Reference in new issue
Block a user