From 9d8ff1fae56a28dfba3d2445cfcb25df166aecdd Mon Sep 17 00:00:00 2001 From: eugene Date: Mon, 31 Jan 2022 12:44:32 -0500 Subject: [PATCH 1/2] config: clamp channel-commit-interval to reasonable time --- config.go | 12 ++++++++++++ sample-lnd.conf | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index 49abb2056..0e77cee1f 100644 --- a/config.go +++ b/config.go @@ -172,6 +172,10 @@ const ( // channel state update and signing a new commitment. 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 // channel state updates that is accumulated before signing a new // commitment. @@ -1562,6 +1566,14 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser, 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 { return nil, mkErr("error parsing gossip syncer: %v", err) } diff --git a/sample-lnd.conf b/sample-lnd.conf index 822d47784..714aaea7d 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -293,8 +293,9 @@ ; 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 -; allows for more efficient channel operations at the cost of latency. -; channel-commit-interval=50ms +; allows for more efficient channel operations at the cost of latency. This is +; 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 ; a new commitment. From cac933df62042be2166fe34ce801e163396e93c2 Mon Sep 17 00:00:00 2001 From: eugene Date: Mon, 31 Jan 2022 12:50:36 -0500 Subject: [PATCH 2/2] release-notes: update for 0.15 --- docs/release-notes/release-notes-0.15.0.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release-notes/release-notes-0.15.0.md b/docs/release-notes/release-notes-0.15.0.md index 0d70b4460..09e55f3b3 100644 --- a/docs/release-notes/release-notes-0.15.0.md +++ b/docs/release-notes/release-notes-0.15.0.md @@ -117,6 +117,8 @@ gRPC performance metrics (latency to process `GetInfo`, etc)](https://github.com was enabled to make sure multi-line `if` conditions and function/method declarations are followed by an empty line to improve readability. +* [The channel-commit-interval is now clamped to a reasonable timeframe of 1h.](https://github.com/lightningnetwork/lnd/pull/6220) + # Contributors (Alphabetical Order) * 3nprob @@ -128,6 +130,7 @@ gRPC performance metrics (latency to process `GetInfo`, etc)](https://github.com * Dan Bolser * Daniel McNally * ErikEk +* Eugene Siegel * henta * Joost Jager * Jordi Montes