Skip to content

Commit 622c840

Browse files
authored
Merge pull request #6611 from Roasbeef/psbt-validation-fix
lnrpc/walletrpc: reject PSBT packets w/o any UTXO input info
2 parents a46ffe4 + 2298ef8 commit 622c840

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

docs/release-notes/release-notes-0.15.0.md

+2
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ from occurring that would result in an erroneous force close.](https://github.co
183183

184184
* [Fixes an issue related to HTLCs on lease enforced channels that can lead to itest flakes](https://github.com/lightningnetwork/lnd/pull/6605/files)
185185

186+
* [Fixes a bug that would cause `SignPsbt` to panic w/ an underspecified packet](https://github.com/lightningnetwork/lnd/pull/6611)
187+
186188
## Routing
187189

188190
* [Add a new `time_pref` parameter to the QueryRoutes and SendPayment APIs](https://github.com/lightningnetwork/lnd/pull/6024) that

lnrpc/walletrpc/walletkit_server.go

+13
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,19 @@ func (w *WalletKit) SignPsbt(_ context.Context, req *SignPsbtRequest) (
12341234
return nil, fmt.Errorf("error parsing PSBT: %v", err)
12351235
}
12361236

1237+
// Before we attempt to sign the packet, ensure that every input either
1238+
// has a witness UTXO, or a non witness UTXO.
1239+
for idx := range packet.UnsignedTx.TxIn {
1240+
in := packet.Inputs[idx]
1241+
1242+
// Doesn't have either a witness or non witness UTXO so we need
1243+
// to exit here as otherwise signing will fail.
1244+
if in.WitnessUtxo == nil && in.NonWitnessUtxo == nil {
1245+
return nil, fmt.Errorf("input (index=%v) doesn't "+
1246+
"specify any UTXO info", idx)
1247+
}
1248+
}
1249+
12371250
// Let the wallet do the heavy lifting. This will sign all inputs that
12381251
// we have the UTXO for. If some inputs can't be signed and don't have
12391252
// witness data attached, they will just be skipped.

0 commit comments

Comments
 (0)