aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorishaanam <ishaana.misra@gmail.com>2022-08-23 15:24:00 -0400
committerishaanam <ishaana.misra@gmail.com>2023-03-18 20:58:15 -0400
commit6e9f8bb050785dbc754b6bb493aad9139908ef98 (patch)
tree58bd4cf39af31fd9413cb79a351b08f39948a519 /test
parenta5b4883fb43d01bfef1244df62c64bf8691ca63a (diff)
downloadbitcoin-6e9f8bb050785dbc754b6bb493aad9139908ef98.tar.xz
rpc, tests: in `utxoupdatepsbt` also look for the transaction in the txindex
Previously only the segwit utxos being spent by the psbt were looked for and added to the psbt. Now, the full transaction corresponding to each of these utxos (legacy and segwit) is looked for in the txindex and mempool and added to the psbt. If txindex is disabled and the transaction is not in the mempool, then we fall back to getting just the utxo (if segwit) from the utxo set.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_psbt.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
index 58a80e37a2..4411329688 100755
--- a/test/functional/rpc_psbt.py
+++ b/test/functional/rpc_psbt.py
@@ -611,17 +611,17 @@ class PSBTTest(BitcoinTestFramework):
# Bech32 inputs should be filled with witness UTXO. Other inputs should not be filled because they are non-witness
updated = self.nodes[1].utxoupdatepsbt(psbt)
decoded = self.nodes[1].decodepsbt(updated)
- test_psbt_input_keys(decoded['inputs'][0], ['witness_utxo'])
- test_psbt_input_keys(decoded['inputs'][1], [])
- test_psbt_input_keys(decoded['inputs'][2], [])
+ test_psbt_input_keys(decoded['inputs'][0], ['witness_utxo', 'non_witness_utxo'])
+ test_psbt_input_keys(decoded['inputs'][1], ['non_witness_utxo'])
+ test_psbt_input_keys(decoded['inputs'][2], ['non_witness_utxo'])
# Try again, now while providing descriptors, making P2SH-segwit work, and causing bip32_derivs and redeem_script to be filled in
descs = [self.nodes[1].getaddressinfo(addr)['desc'] for addr in [addr1,addr2,addr3]]
updated = self.nodes[1].utxoupdatepsbt(psbt=psbt, descriptors=descs)
decoded = self.nodes[1].decodepsbt(updated)
- test_psbt_input_keys(decoded['inputs'][0], ['witness_utxo', 'bip32_derivs'])
- test_psbt_input_keys(decoded['inputs'][1], [])
- test_psbt_input_keys(decoded['inputs'][2], ['witness_utxo', 'bip32_derivs', 'redeem_script'])
+ test_psbt_input_keys(decoded['inputs'][0], ['witness_utxo', 'non_witness_utxo', 'bip32_derivs'])
+ test_psbt_input_keys(decoded['inputs'][1], ['non_witness_utxo', 'bip32_derivs'])
+ test_psbt_input_keys(decoded['inputs'][2], ['non_witness_utxo','witness_utxo', 'bip32_derivs', 'redeem_script'])
# Two PSBTs with a common input should not be joinable
psbt1 = self.nodes[1].createpsbt([{"txid":txid1, "vout":vout1}], {self.nodes[0].getnewaddress():Decimal('10.999')})