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:
1 parent
4142d19d74
commit
e47ce42f67
8 files changed
+16
-8
No files matched your search
@@ -3,6 +3,7 @@
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test the scanblocks RPC call."""
|
||||
from test_framework.address import address_to_scriptpubkey
|
||||
from test_framework.blockfilter import (
|
||||
bip158_basic_element_hash,
|
||||
bip158_relevant_scriptpubkeys,
|
||||
@@ -36,7 +37,7 @@ class ScanblocksTest(BitcoinTestFramework):
|
||||
# send 1.0, mempool only
|
||||
# childkey 5 of `parent_key`
|
||||
wallet.send_to(from_node=node,
|
||||
scriptPubKey=bytes.fromhex(node.validateaddress("mkS4HXoTYWRTescLGaUTGbtTTYX5EjJyEE")['scriptPubKey']),
|
||||
scriptPubKey=address_to_scriptpubkey("mkS4HXoTYWRTescLGaUTGbtTTYX5EjJyEE"),
|
||||
amount=1 * COIN)
|
||||
|
||||
# mine a block and assure that the mined blockhash is in the filterresult
|
||||
|
||||
Reference in new issue
Block a user