Skip to content

Commit b954ee4

Browse files
committed
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.
1 parent ab7634b commit b954ee4

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

lnrpc/walletrpc/walletkit_server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,12 +1574,12 @@ func (w *WalletKit) fundPsbtInternalWallet(account string,
15741574
return true
15751575
}
15761576

1577-
eligible := fn.Filter(filterFn, utxos)
1577+
eligibleUtxos := fn.Filter(filterFn, utxos)
15781578

15791579
// Validate all inputs against our known list of UTXOs
15801580
// now.
15811581
err = verifyInputsUnspent(
1582-
packet.UnsignedTx.TxIn, eligible,
1582+
packet.UnsignedTx.TxIn, eligibleUtxos,
15831583
)
15841584
if err != nil {
15851585
return err

rpcserver.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,7 @@ func newFundingShimAssembler(chanPointShim *lnrpc.ChanPointShim, initiator bool,
18901890

18911891
// newFundingShimAssembler returns a new fully populated
18921892
// chanfunding.PsbtAssembler using a FundingShim obtained from an RPC caller.
1893-
func newPsbtAssembler(req *lnrpc.OpenChannelRequest, normalizedMinConfs int32,
1893+
func newPsbtAssembler(req *lnrpc.OpenChannelRequest,
18941894
psbtShim *lnrpc.PsbtShim, netParams *chaincfg.Params) (
18951895
chanfunding.Assembler, error) {
18961896

@@ -1904,11 +1904,6 @@ func newPsbtAssembler(req *lnrpc.OpenChannelRequest, normalizedMinConfs int32,
19041904
if len(psbtShim.PendingChanId) != 32 {
19051905
return nil, fmt.Errorf("pending chan ID not set")
19061906
}
1907-
if normalizedMinConfs != 1 {
1908-
return nil, fmt.Errorf("setting non-default values for " +
1909-
"minimum confirmation is not supported for PSBT " +
1910-
"funding")
1911-
}
19121907
if req.SatPerByte != 0 || req.SatPerVbyte != 0 || req.TargetConf != 0 { // nolint:staticcheck
19131908
return nil, fmt.Errorf("specifying fee estimation parameters " +
19141909
"is not supported for PSBT funding")
@@ -2351,8 +2346,12 @@ func (r *rpcServer) OpenChannel(in *lnrpc.OpenChannelRequest,
23512346
// chanfunding.PsbtAssembler to construct the funding
23522347
// transaction.
23532348
copy(req.PendingChanID[:], psbtShim.PendingChanId)
2349+
2350+
// NOTE: For the PSBT case we do also allow unconfirmed
2351+
// utxos to fund the psbt transaction because we make
2352+
// sure we only use stable utxos.
23542353
req.ChanFunder, err = newPsbtAssembler(
2355-
in, req.MinConfs, psbtShim,
2354+
in, psbtShim,
23562355
&r.server.cc.Wallet.Cfg.NetParams,
23572356
)
23582357
if err != nil {

0 commit comments

Comments
 (0)