lnwallet/chanfunding: assert PSBT Inputs have WitnessUtxo

This commit is contained in:
eugene 2021-04-22 12:18:04 -04:00
parent 9e2cccdbbd
commit b3f14d66f0
No known key found for this signature in database
GPG Key ID: 118759E83439A9B1

View File

@ -249,6 +249,15 @@ func (i *PsbtIntent) Verify(packet *psbt.Packet) error {
"output amount sum") "output amount sum")
} }
// SumUtxoInputValues checks that packet.Inputs is non-empty. Here we
// check that each Input has a WitnessUtxo field, to avoid possible
// malleability.
for _, in := range packet.Inputs {
if in.WitnessUtxo == nil {
return fmt.Errorf("not all inputs are segwit spends")
}
}
i.PendingPsbt = packet i.PendingPsbt = packet
i.State = PsbtVerified i.State = PsbtVerified
return nil return nil