mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-02 19:52:01 +02: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:
@ -7,6 +7,7 @@
|
||||
import os
|
||||
from typing import List
|
||||
|
||||
from test_framework.address import address_to_scriptpubkey
|
||||
from test_framework.descriptors import descsum_create
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.test_node import TestNode
|
||||
@ -58,7 +59,7 @@ class WalletFastRescanTest(BitcoinTestFramework):
|
||||
if 'range' in desc_info:
|
||||
start_range, end_range = desc_info['range']
|
||||
addr = w.deriveaddresses(desc_info['desc'], [end_range, end_range])[0]
|
||||
spk = bytes.fromhex(w.getaddressinfo(addr)['scriptPubKey'])
|
||||
spk = address_to_scriptpubkey(addr)
|
||||
self.log.info(f"-> range [{start_range},{end_range}], last address {addr}")
|
||||
else:
|
||||
spk = bytes.fromhex(fixed_key.p2wpkh_script)
|
||||
|
Reference in New Issue
Block a user