diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-10-21 10:06:00 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-10-21 10:07:06 +0200 |
commit | 9aa4ddb410b2efc1806358b6f6474d33a315bff4 (patch) | |
tree | d62a7c79b797d33889c5474266922d0b9d6ed579 /test/functional/wallet_importdescriptors.py | |
parent | 3e3f53c77e734aa11cc27c663dacfe963b84ff90 (diff) | |
parent | 130ee481082d2612d452d7d69131ade935b225b5 (diff) |
Merge bitcoin/bitcoin#23287: test: get and decode tx with a single `gettransaction` RPC call
130ee481082d2612d452d7d69131ade935b225b5 test: get and decode tx with a single `gettransaction` RPC call (Sebastian Falbesoner)
Pull request description:
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 simply be replaced by:
```
node.gettransaction(txid=txid, verbose=True)['decoded']
```
Rationale: shorter code, shorter test logs, less RPC calls.
ACKs for top commit:
stratospher:
tested ACK 130ee48
amadeuszpawlik:
tACK 130ee481082d2612d452d7d69131ade935b225b5
lsilva01:
Tested ACK 130ee48 on Ubuntu 20.04.
shaavan:
ACK 130ee481082d2612d452d7d69131ade935b225b5
Tree-SHA512: cf0bd26e1e21b8022fb8062857906e0706f0ee32d3277f985c461e2519405afe445ab005f5f763fb268c7b4d6e48b2d47eda7af8621b3bce67cece8dfc9bc153
Diffstat (limited to 'test/functional/wallet_importdescriptors.py')
-rwxr-xr-x | test/functional/wallet_importdescriptors.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/test/functional/wallet_importdescriptors.py b/test/functional/wallet_importdescriptors.py index c8f9664885..fc9eac1d74 100755 --- a/test/functional/wallet_importdescriptors.py +++ b/test/functional/wallet_importdescriptors.py @@ -454,7 +454,7 @@ class ImportDescriptorsTest(BitcoinTestFramework): self.generate(self.nodes[0], 6) self.sync_all() send_txid = wmulti_priv.sendtoaddress(w0.getnewaddress(), 8) - decoded = wmulti_priv.decoderawtransaction(wmulti_priv.gettransaction(send_txid)['hex']) + decoded = wmulti_priv.gettransaction(txid=send_txid, verbose=True)['decoded'] assert_equal(len(decoded['vin'][0]['txinwitness']), 4) self.generate(self.nodes[0], 6) self.sync_all() @@ -586,7 +586,7 @@ class ImportDescriptorsTest(BitcoinTestFramework): self.sync_all() # It is standard and would relay. txid = wmulti_priv_big.sendtoaddress(w0.getnewaddress(), 9.999) - decoded = wmulti_priv_big.decoderawtransaction(wmulti_priv_big.gettransaction(txid)['hex']) + decoded = wmulti_priv_big.gettransaction(txid=txid, verbose=True)['decoded'] # 20 sigs + dummy + witness script assert_equal(len(decoded['vin'][0]['txinwitness']), 22) @@ -620,12 +620,8 @@ class ImportDescriptorsTest(BitcoinTestFramework): self.generate(self.nodes[0], 6) self.sync_all() # It is standard and would relay. - txid = multi_priv_big.sendtoaddress(w0.getnewaddress(), 10, "", "", - True) - decoded = multi_priv_big.decoderawtransaction( - multi_priv_big.gettransaction(txid)['hex'] - ) - + txid = multi_priv_big.sendtoaddress(w0.getnewaddress(), 10, "", "", True) + decoded = multi_priv_big.gettransaction(txid=txid, verbose=True)['decoded'] self.log.info("Amending multisig with new private keys") self.nodes[1].createwallet(wallet_name="wmulti_priv3", descriptors=True) |