mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 15:11:09 +02:00
config: clamp channel-commit-interval to reasonable time
This commit is contained in:
12
config.go
12
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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user