From ef69537c7f8d7b702f585831df8e3a746b8a756b Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 12 Aug 2020 15:45:39 -0700 Subject: [PATCH] fundingmanager: add maxHtlcs to openChanReq --- fundingmanager.go | 6 +++++- server.go | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fundingmanager.go b/fundingmanager.go index 826df8ab..e6a53dc0 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -3110,6 +3110,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) { minHtlcIn = msg.minHtlcIn remoteCsvDelay = msg.remoteCsvDelay maxValue = msg.maxValueInFlight + maxHtlcs = msg.maxHtlcs ) // We'll determine our dust limit depending on which chain is active. @@ -3248,6 +3249,10 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) { maxValue = f.cfg.RequiredRemoteMaxValue(capacity) } + if maxHtlcs == 0 { + maxHtlcs = f.cfg.RequiredRemoteMaxHTLCs(capacity) + } + // If a pending channel map for this peer isn't already created, then // we create one, ultimately allowing us to track this pending // reservation within the target peer. @@ -3281,7 +3286,6 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) { // policy to determine of required commitment constraints for the // remote party. chanReserve := f.cfg.RequiredRemoteChanReserve(capacity, ourDustLimit) - maxHtlcs := f.cfg.RequiredRemoteMaxHTLCs(capacity) fndgLog.Infof("Starting funding workflow with %v for pending_id(%x), "+ "committype=%v", msg.peer.Address(), chanID, commitType) diff --git a/server.go b/server.go index 626c9099..e1ef0c68 100644 --- a/server.go +++ b/server.go @@ -3343,6 +3343,8 @@ type openChanReq struct { // be pending within the channel. It only applies to the remote party. maxValueInFlight lnwire.MilliSatoshi + maxHtlcs uint16 + // TODO(roasbeef): add ability to specify channel constraints as well // chanFunder is an optional channel funder that allows the caller to