mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-23 12:14:30 +01:00
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:
@@ -20,6 +20,7 @@ import time
|
||||
|
||||
from . import coverage
|
||||
from .authproxy import AuthServiceProxy, JSONRPCException
|
||||
from .descriptors import descsum_create
|
||||
from collections.abc import Callable
|
||||
from typing import Optional, Union
|
||||
|
||||
@@ -609,3 +610,13 @@ def sync_txindex(test_framework, node):
|
||||
sync_start = int(time.time())
|
||||
test_framework.wait_until(lambda: node.getindexinfo("txindex")["txindex"]["synced"])
|
||||
test_framework.log.debug(f"Synced in {time.time() - sync_start} seconds")
|
||||
|
||||
def wallet_importprivkey(wallet_rpc, privkey, timestamp, *, label=""):
|
||||
desc = descsum_create("combo(" + privkey + ")")
|
||||
req = [{
|
||||
"desc": desc,
|
||||
"timestamp": timestamp,
|
||||
"label": label,
|
||||
}]
|
||||
import_res = wallet_rpc.importdescriptors(req)
|
||||
assert_equal(import_res[0]["success"], True)
|
||||
|
||||
Reference in New Issue
Block a user