Merge pull request #4527 from cfromknecht/configurable-remote-max-htlcs
fundingmanager: configurable remote max htlcs
This commit is contained in:
9 files changed
+825
-746
No files matched your search
@@ -1743,6 +1743,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||
minHtlcIn := lnwire.MilliSatoshi(in.MinHtlcMsat)
|
||||
remoteCsvDelay := uint16(in.RemoteCsvDelay)
|
||||
maxValue := lnwire.MilliSatoshi(in.RemoteMaxValueInFlightMsat)
|
||||
maxHtlcs := uint16(in.RemoteMaxHtlcs)
|
||||
|
||||
globalFeatureSet := r.server.featureMgr.Get(feature.SetNodeAnn)
|
||||
|
||||
@@ -1775,6 +1776,13 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||
"channel size is: %v SAT", int64(minChanFundingSize))
|
||||
}
|
||||
|
||||
// Prevent users from submitting a max-htlc value that would exceed the
|
||||
// protocol maximum.
|
||||
if maxHtlcs > input.MaxHTLCNumber/2 {
|
||||
return nil, fmt.Errorf("remote-max-htlcs (%v) cannot be "+
|
||||
"greater than %v", maxHtlcs, input.MaxHTLCNumber/2)
|
||||
}
|
||||
|
||||
// Then, we'll extract the minimum number of confirmations that each
|
||||
// output we use to fund the channel's funding transaction should
|
||||
// satisfy.
|
||||
@@ -1863,6 +1871,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||
minConfs: minConfs,
|
||||
shutdownScript: script,
|
||||
maxValueInFlight: maxValue,
|
||||
maxHtlcs: maxHtlcs,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user