test: Replace importprivkey with wallet_importprivkey

importprivkey was a legacy wallet only RPC which had a helper for
descriptor wallets in tests. Add wallet_importprivkey helper and use it
wherever importprivkey is used (other than backward compatibility tests)
This commit is contained in:
Ava Chow committed 2025-05-09 11:42:33 -07:00
1 parent 94c87bbbd0
commit fcc457573f
10 files changed
+33 -26

No files matched your search

+2 -1
View File
@@ -10,6 +10,7 @@ from test_framework.blocktools import COINBASE_MATURITY
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
wallet_importprivkey,
)
@@ -39,7 +40,7 @@ class WalletHDTest(BitcoinTestFramework):
# Import a non-HD private key in the HD wallet
non_hd_add = 'bcrt1qmevj8zfx0wdvp05cqwkmr6mxkfx60yezwjksmt'
non_hd_key = 'cS9umN9w6cDMuRVYdbkfE4c7YUFLJRoXMfhQ569uY4odiQbVN8Rt'
self.nodes[1].importprivkey(non_hd_key)
wallet_importprivkey(self.nodes[1], non_hd_key, "now")
# This should be enough to keep the master key and the non-HD key
self.nodes[1].backupwallet(self.nodes[1].datadir_path / "hd.bak")