mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
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:
parent
e7f338fded
commit
4da26fb65a
2 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -255,8 +255,9 @@ func (r *RPCKeyRing) SignPsbt(packet *psbt.Packet) ([]uint32, error) {
|
|||
// parameter in FinalizePsbt so we can get rid of this code duplication.
|
||||
func (r *RPCKeyRing) FinalizePsbt(packet *psbt.Packet, _ string) error {
|
||||
// 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 err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue