mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
Merge pull request #6217 from liviu-ln/psbt-finalize-check
walletrpc: return an error when finalizing an already complete PSBT
This commit is contained in:
commit
95c270d1f8
@ -106,6 +106,8 @@
|
|||||||
* [Add ForAll implementation for etcd to speed up
|
* [Add ForAll implementation for etcd to speed up
|
||||||
graph cache at startup](https://github.com/lightningnetwork/lnd/pull/6136)
|
graph cache at startup](https://github.com/lightningnetwork/lnd/pull/6136)
|
||||||
|
|
||||||
|
* [Improve validation of a PSBT packet when handling a request to finalize it.](https://github.com/lightningnetwork/lnd/pull/6217)
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
* Improved instructions on [how to build lnd for mobile](https://github.com/lightningnetwork/lnd/pull/6085).
|
* Improved instructions on [how to build lnd for mobile](https://github.com/lightningnetwork/lnd/pull/6085).
|
||||||
|
@ -1254,8 +1254,7 @@ func (w *WalletKit) FinalizePsbt(_ context.Context,
|
|||||||
account = req.Account
|
account = req.Account
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the funded PSBT. No additional checks are required at this
|
// Parse the funded PSBT.
|
||||||
// level as the wallet will perform all of them.
|
|
||||||
packet, err := psbt.NewFromRawBytes(
|
packet, err := psbt.NewFromRawBytes(
|
||||||
bytes.NewReader(req.FundedPsbt), false,
|
bytes.NewReader(req.FundedPsbt), false,
|
||||||
)
|
)
|
||||||
@ -1263,6 +1262,12 @@ func (w *WalletKit) FinalizePsbt(_ context.Context,
|
|||||||
return nil, fmt.Errorf("error parsing PSBT: %v", err)
|
return nil, fmt.Errorf("error parsing PSBT: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The only check done at this level is to validate that the PSBT is
|
||||||
|
// not complete. The wallet performs all other checks.
|
||||||
|
if packet.IsComplete() {
|
||||||
|
return nil, fmt.Errorf("PSBT is already fully signed")
|
||||||
|
}
|
||||||
|
|
||||||
// Let the wallet do the heavy lifting. This will sign all inputs that
|
// Let the wallet do the heavy lifting. This will sign all inputs that
|
||||||
// we have the UTXO for. If some inputs can't be signed and don't have
|
// we have the UTXO for. If some inputs can't be signed and don't have
|
||||||
// witness data attached, this will fail.
|
// witness data attached, this will fail.
|
||||||
|
Loading…
Reference in New Issue
Block a user