btcwallet+rpcwallet: verify input data for psbt package

Use the new method in the psbt package InputsReadyToSign which
makes sure that each input has either nonWitness Utxo or
witness Utxo data specified.
This commit is contained in:
ziggie
2023-03-20 22:43:15 +01:00
parent e7f338fded
commit 4da26fb65a
2 changed files with 6 additions and 4 deletions

View File

@@ -135,8 +135,9 @@ func (b *BtcWallet) SignPsbt(packet *psbt.Packet) ([]uint32, error) {
var signedInputs []uint32
// Let's check that this is actually something we can and want to sign.
// We need at least one input and one output.
err := psbt.VerifyInputOutputLen(packet, true, true)
// We need at least one input and one output. In addition each
// input needs nonWitness Utxo or witness Utxo data specified.
err := psbt.InputsReadyToSign(packet)
if err != nil {
return nil, err
}