mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
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.
This commit is contained in:
@ -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')})
|
||||
|
Reference in New Issue
Block a user