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:
ismaelsadeeq
2023-03-28 16:58:16 +01:00
parent 4142d19d74
commit e47ce42f67
8 changed files with 16 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import itertools
import json
import os
from test_framework.address import address_to_scriptpubkey
from test_framework.blocktools import COINBASE_MATURITY
from test_framework.authproxy import JSONRPCException
from test_framework.descriptors import descsum_create, drop_origins
@ -193,7 +194,7 @@ class RpcCreateMultiSigTest(BitcoinTestFramework):
assert mredeemw == mredeem
wmulti.unloadwallet()
spk = bytes.fromhex(node0.validateaddress(madd)["scriptPubKey"])
spk = address_to_scriptpubkey(madd)
txid, _ = self.wallet.send_to(from_node=self.nodes[0], scriptPubKey=spk, amount=1300)
tx = node0.getrawtransaction(txid, True)
vout = [v["n"] for v in tx["vout"] if madd == v["scriptPubKey"]["address"]]