mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-03 17:30:25 +01:00
refactor: use address_to_scriptpubkey to retrieve addresses scriptpubkey
This commit updates the code by replacing the RPC call used to decode an address and retrieve its corresponding scriptpubkey with the address_to_scriptpubkey function. address_to_scriptpubkey function can now decode all addresses formats, which makes it more efficient to use.
This commit is contained in:
@@ -13,6 +13,7 @@ from typing import (
|
||||
Optional,
|
||||
)
|
||||
from test_framework.address import (
|
||||
address_to_scriptpubkey,
|
||||
create_deterministic_address_bcrt1_p2tr_op_true,
|
||||
key_to_p2pkh,
|
||||
key_to_p2sh_p2wpkh,
|
||||
@@ -96,7 +97,7 @@ class MiniWallet:
|
||||
self._scriptPubKey = key_to_p2pk_script(pub_key.get_bytes())
|
||||
elif mode == MiniWalletMode.ADDRESS_OP_TRUE:
|
||||
self._address, self._internal_key = create_deterministic_address_bcrt1_p2tr_op_true()
|
||||
self._scriptPubKey = bytes.fromhex(self._test_node.validateaddress(self._address)['scriptPubKey'])
|
||||
self._scriptPubKey = address_to_scriptpubkey(self._address)
|
||||
|
||||
# When the pre-mined test framework chain is used, it contains coinbase
|
||||
# outputs to the MiniWallet's default address in blocks 76-100
|
||||
|
||||
Reference in New Issue
Block a user