diff --git a/psbt_channel_funder.go b/psbt_channel_funder.go index 42dde5888..b43ca3cf0 100644 --- a/psbt_channel_funder.go +++ b/psbt_channel_funder.go @@ -97,9 +97,8 @@ func (l *LndPbstChannelFunder) OpenChannel(ctx context.Context, // We'll map our high level params into a request for a: private, // taproot channel, that uses the PSBT funding flow. taprootCommitType := lnrpc.CommitmentType_SIMPLE_TAPROOT_OVERLAY - openChanStream, errChan, err := l.lnd.Client.OpenChannelStream( - ctx, route.NewVertex(&req.PeerPub), req.ChanAmt, req.PushAmt, - true, lndclient.WithCommitmentType(&taprootCommitType), + channelOpenOptions := []lndclient.OpenChannelOption{ + lndclient.WithCommitmentType(&taprootCommitType), lndclient.WithFundingShim(&lnrpc.FundingShim{ Shim: &lnrpc.FundingShim_PsbtShim{ PsbtShim: &lnrpc.PsbtShim{ @@ -110,6 +109,20 @@ func (l *LndPbstChannelFunder) OpenChannel(ctx context.Context, }, }), lndclient.WithRemoteReserve(CustomChannelRemoteReserve), + } + + // Limit the number of HTLCs that can be added to the channel by the + // remote party. + if req.RemoteMaxHtlc > 0 { + channelOpenOptions = append( + channelOpenOptions, + lndclient.WithRemoteMaxHtlc(req.RemoteMaxHtlc), + ) + } + + openChanStream, errChan, err := l.lnd.Client.OpenChannelStream( + ctx, route.NewVertex(&req.PeerPub), req.ChanAmt, req.PushAmt, + true, channelOpenOptions..., ) if err != nil { return nil, fmt.Errorf("unable to open channel with "+ diff --git a/tapchannel/aux_funding_controller.go b/tapchannel/aux_funding_controller.go index e0c5c9e37..de711bcd7 100644 --- a/tapchannel/aux_funding_controller.go +++ b/tapchannel/aux_funding_controller.go @@ -94,6 +94,11 @@ type OpenChanReq struct { // PushAmt is the amount of BTC to push to the remote peer. PushAmt btcutil.Amount + // RemoteMaxHtlc is the maximum number of HTLCs we allow the remote to + // add to the channel. If this is zero, then the default value defined + // by lnd (and dependent on the channel capacity) will be used. + RemoteMaxHtlc uint32 + // PeerPub is the identity public key of the remote peer we wish to // open the channel with. PeerPub btcec.PublicKey