mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-02 19:52:01 +02:00
Merge bitcoin/bitcoin#23287: test: get and decode tx with a single gettransaction
RPC call
130ee48108
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 ACK130ee48
amadeuszpawlik: tACK130ee48108
lsilva01: Tested ACK130ee48
on Ubuntu 20.04. shaavan: ACK130ee48108
Tree-SHA512: cf0bd26e1e21b8022fb8062857906e0706f0ee32d3277f985c461e2519405afe445ab005f5f763fb268c7b4d6e48b2d47eda7af8621b3bce67cece8dfc9bc153
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user