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
2025-05-08 11:26:34 -07:00
parent 94c87bbbd0
commit fcc457573f
10 changed files with 33 additions and 26 deletions

View File

@@ -35,6 +35,7 @@ from .util import (
initialize_datadir,
p2p_port,
wait_until_helper_internal,
wallet_importprivkey,
)
@@ -485,7 +486,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
n = self.nodes[node]
if wallet_name is not None:
n.createwallet(wallet_name=wallet_name, load_on_startup=True)
n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase', rescan=True)
wallet_importprivkey(n.get_wallet_rpc(wallet_name), n.get_deterministic_priv_key().key, 0, label="coinbase")
def run_test(self):
"""Tests must override this method to define test logic"""