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

+3 -2
View File
@@ -15,6 +15,7 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
wallet_importprivkey,
)
from test_framework.wallet_util import generate_keypair
@@ -38,7 +39,7 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
# privkey
address3_privkey, address3_pubkey = generate_keypair(wif=True)
address3 = key_to_p2wpkh(address3_pubkey)
self.nodes[0].importprivkey(address3_privkey)
wallet_importprivkey(self.nodes[0], address3_privkey, "now")
# Check only one address
address_info = self.nodes[0].getaddressinfo(address1)
@@ -95,7 +96,7 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
# Import with private key with no rescan
w1 = self.nodes[1].get_wallet_rpc(self.default_wallet_name)
w1.importprivkey(privkey=address3_privkey, rescan=False)
wallet_importprivkey(w1, address3_privkey, "now")
w1.importprunedfunds(rawtxn3, proof3)
assert [tx for tx in w1.listtransactions() if tx['txid'] == txnid3]
balance3 = w1.getbalance()