Merge pull request #6220 from Crypt-iQ/batch_ticker_clamp

config: clamp channel-commit-interval to reasonable time
This commit is contained in:
Olaoluwa Osuntokun
2022-03-02 17:07:35 -08:00
committed by GitHub
3 changed files with 17 additions and 2 deletions

View File

@@ -172,6 +172,10 @@ const (
// channel state update and signing a new commitment. // channel state update and signing a new commitment.
defaultChannelCommitInterval = 50 * time.Millisecond defaultChannelCommitInterval = 50 * time.Millisecond
// maxChannelCommitInterval is the maximum time the commit interval can
// be configured to.
maxChannelCommitInterval = time.Hour
// defaultChannelCommitBatchSize is the default maximum number of // defaultChannelCommitBatchSize is the default maximum number of
// channel state updates that is accumulated before signing a new // channel state updates that is accumulated before signing a new
// commitment. // commitment.
@@ -1562,6 +1566,14 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
maxRemoteHtlcs) maxRemoteHtlcs)
} }
// Clamp the ChannelCommitInterval so that commitment updates can still
// happen in a reasonable timeframe.
if cfg.ChannelCommitInterval > maxChannelCommitInterval {
return nil, mkErr("channel-commit-interval (%v) must be less "+
"than %v", cfg.ChannelCommitInterval,
maxChannelCommitInterval)
}
if err := cfg.Gossip.Parse(); err != nil { if err := cfg.Gossip.Parse(); err != nil {
return nil, mkErr("error parsing gossip syncer: %v", err) return nil, mkErr("error parsing gossip syncer: %v", err)
} }

View File

@@ -128,6 +128,8 @@ gRPC performance metrics (latency to process `GetInfo`, etc)](https://github.com
* [`ChannelLink` in the `htlcswitch` now performs a 2-way handoff instead of a 1-way handoff with its `ChannelArbitrator`.](https://github.com/lightningnetwork/lnd/pull/6221) * [`ChannelLink` in the `htlcswitch` now performs a 2-way handoff instead of a 1-way handoff with its `ChannelArbitrator`.](https://github.com/lightningnetwork/lnd/pull/6221)
* [The channel-commit-interval is now clamped to a reasonable timeframe of 1h.](https://github.com/lightningnetwork/lnd/pull/6220)
# Contributors (Alphabetical Order) # Contributors (Alphabetical Order)
* 3nprob * 3nprob

View File

@@ -293,8 +293,9 @@
; The maximum time that is allowed to pass between receiving a channel state ; The maximum time that is allowed to pass between receiving a channel state
; update and signing the next commitment. Setting this to a longer duration ; update and signing the next commitment. Setting this to a longer duration
; allows for more efficient channel operations at the cost of latency. ; allows for more efficient channel operations at the cost of latency. This is
; channel-commit-interval=50ms ; capped at 1 hour. The default is 50 milliseconds.
; channel-commit-interval=1h
; The maximum number of channel state updates that is accumulated before signing ; The maximum number of channel state updates that is accumulated before signing
; a new commitment. ; a new commitment.