mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-22 15:57:49 +02:00
rpcserver: allow unconf. inputs for psbt shim.
Allow unconfirmed inputs to be used when funding a channel via the psbt channel opening flow. We do now check for unstable utxos.
This commit is contained in:
@@ -1574,12 +1574,12 @@ func (w *WalletKit) fundPsbtInternalWallet(account string,
|
||||
return true
|
||||
}
|
||||
|
||||
eligible := fn.Filter(filterFn, utxos)
|
||||
eligibleUtxos := fn.Filter(filterFn, utxos)
|
||||
|
||||
// Validate all inputs against our known list of UTXOs
|
||||
// now.
|
||||
err = verifyInputsUnspent(
|
||||
packet.UnsignedTx.TxIn, eligible,
|
||||
packet.UnsignedTx.TxIn, eligibleUtxos,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
13
rpcserver.go
13
rpcserver.go
@@ -1890,7 +1890,7 @@ func newFundingShimAssembler(chanPointShim *lnrpc.ChanPointShim, initiator bool,
|
||||
|
||||
// newFundingShimAssembler returns a new fully populated
|
||||
// chanfunding.PsbtAssembler using a FundingShim obtained from an RPC caller.
|
||||
func newPsbtAssembler(req *lnrpc.OpenChannelRequest, normalizedMinConfs int32,
|
||||
func newPsbtAssembler(req *lnrpc.OpenChannelRequest,
|
||||
psbtShim *lnrpc.PsbtShim, netParams *chaincfg.Params) (
|
||||
chanfunding.Assembler, error) {
|
||||
|
||||
@@ -1904,11 +1904,6 @@ func newPsbtAssembler(req *lnrpc.OpenChannelRequest, normalizedMinConfs int32,
|
||||
if len(psbtShim.PendingChanId) != 32 {
|
||||
return nil, fmt.Errorf("pending chan ID not set")
|
||||
}
|
||||
if normalizedMinConfs != 1 {
|
||||
return nil, fmt.Errorf("setting non-default values for " +
|
||||
"minimum confirmation is not supported for PSBT " +
|
||||
"funding")
|
||||
}
|
||||
if req.SatPerByte != 0 || req.SatPerVbyte != 0 || req.TargetConf != 0 { // nolint:staticcheck
|
||||
return nil, fmt.Errorf("specifying fee estimation parameters " +
|
||||
"is not supported for PSBT funding")
|
||||
@@ -2351,8 +2346,12 @@ func (r *rpcServer) OpenChannel(in *lnrpc.OpenChannelRequest,
|
||||
// chanfunding.PsbtAssembler to construct the funding
|
||||
// transaction.
|
||||
copy(req.PendingChanID[:], psbtShim.PendingChanId)
|
||||
|
||||
// NOTE: For the PSBT case we do also allow unconfirmed
|
||||
// utxos to fund the psbt transaction because we make
|
||||
// sure we only use stable utxos.
|
||||
req.ChanFunder, err = newPsbtAssembler(
|
||||
in, req.MinConfs, psbtShim,
|
||||
in, psbtShim,
|
||||
&r.server.cc.Wallet.Cfg.NetParams,
|
||||
)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user