mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-15 16:38:23 +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:
@@ -10,6 +10,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, WalletUnlock
|
||||
|
||||
@@ -65,7 +66,7 @@ class CreateWalletTest(BitcoinTestFramework):
|
||||
assert_raises_rpc_error(-4, "Error: This wallet has no available keys", w3.getnewaddress)
|
||||
assert_raises_rpc_error(-4, "Error: This wallet has no available keys", w3.getrawchangeaddress)
|
||||
# Import private key
|
||||
w3.importprivkey(generate_keypair(wif=True)[0])
|
||||
wallet_importprivkey(w3, generate_keypair(wif=True)[0], "now")
|
||||
# Imported private keys are currently ignored by the keypool
|
||||
assert_equal(w3.getwalletinfo()['keypoolsize'], 0)
|
||||
assert_raises_rpc_error(-4, "Error: This wallet has no available keys", w3.getnewaddress)
|
||||
|
||||
Reference in New Issue
Block a user