From 1e030c2d48e3eae4f33eb3281ab24fe8019bc441 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Sat, 10 Sep 2022 12:04:48 -0400 Subject: [PATCH] rpcserver: parse channel fees into InitFundingMsg --- rpcserver.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rpcserver.go b/rpcserver.go index 424d16bd4..ecd98ec62 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1922,12 +1922,21 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest, // satoshis) does not exceed the amount the local party has requested // for funding. // - // TODO(roasbeef): incorporate base fee? if remoteInitialBalance >= localFundingAmt { return nil, fmt.Errorf("amount pushed to remote peer for " + "initial state must be below the local funding amount") } + // Determine if the user provided channel fees + // and if so pass them on to the funding workflow. + var channelBaseFee, channelFeeRate *uint64 + if in.UseBaseFee { + channelBaseFee = &in.BaseFee + } + if in.UseFeeRate { + channelFeeRate = &in.FeeRate + } + // Ensure that the user doesn't exceed the current soft-limit for // channel size. If the funding amount is above the soft-limit, then // we'll reject the request. @@ -2086,6 +2095,8 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest, TargetPubkey: nodePubKey, ChainHash: *r.cfg.ActiveNetParams.GenesisHash, LocalFundingAmt: localFundingAmt, + BaseFee: channelBaseFee, + FeeRate: channelFeeRate, PushAmt: lnwire.NewMSatFromSatoshis(remoteInitialBalance), MinHtlcIn: minHtlcIn, FundingFeePerKw: feeRate,