mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-03 14:13:00 +02:00
test: get and decode tx with a single gettransaction
RPC call
Rather than subsequently calling `gettransaction` and `decoderawtransaction` to get the decoded information for a specific tx-id, we can simply use the verbose version of `gettransaction`, which returns this in a 'decoded' key. I.e. node.decoderawtransaction(node.gettransaction(txid)['hex']) can be replaced by: node.gettransaction(txid=txid, verbose=True)['decoded']
This commit is contained in:
@@ -666,7 +666,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
self.generate(self.nodes[0], 1)
|
||||
destination = self.nodes[1].getnewaddress()
|
||||
txid = self.nodes[0].sendtoaddress(destination, 0.123)
|
||||
tx = self.nodes[0].decoderawtransaction(self.nodes[0].gettransaction(txid)['hex'])
|
||||
tx = self.nodes[0].gettransaction(txid=txid, verbose=True)['decoded']
|
||||
output_addresses = [vout['scriptPubKey']['address'] for vout in tx["vout"]]
|
||||
assert len(output_addresses) > 1
|
||||
for address in output_addresses:
|
||||
|
Reference in New Issue
Block a user