lncfg: add new dev config option for scaling channel close confs
What changed, and why it matters
This commit adds a new developer-only configuration option that lets tests force a specific number of blockchain confirmations for channel closes. It is gated behind integration/dev builds and does not change production behavior. There is no security issue visible in this patch.
No security action required. Review the follow-up commits that consume ChannelCloseConfs() to confirm the override is only used in test/dev paths and cannot be enabled in production builds.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change introduces ForceChannelCloseConfs in the dev-integration DevConfig and a corresponding ChannelCloseConfs() accessor that returns an Option[uint32]. In production builds (dev.go), the accessor always returns None, so the new setting has no effect. In integration test builds (dev_integration.go), a non-zero value is returned as Some(…). This is purely a test harness/scaling knob and does not alter consensus, wallet, or network security logic in production code paths.
Changed components
lncfg/dev.golncfg/dev_integration.goInspect captured patch +19 / −0
diff --git a/lncfg/dev.go b/lncfg/dev.go
index f048d69..8e0c9dd 100644
--- a/lncfg/dev.go
+++ b/lncfg/dev.go
@@ -5,6 +5,7 @@ package lncfg
import (
"time"
+ "github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/lnwallet/chanfunding"
)
@@ -58,3 +59,9 @@ func (d *DevConfig) GetMaxWaitNumBlocksFundingConf() uint32 {
func (d *DevConfig) GetUnsafeConnect() bool {
return false
}
+
+// ChannelCloseConfs returns the config value for channel close confirmations
+// override, which is always None for production build.
+func (d *DevConfig) ChannelCloseConfs() fn.Option[uint32] {
+ return fn.None[uint32]()
+}
diff --git a/lncfg/dev_integration.go b/lncfg/dev_integration.go
index 8ac85f5..b299fb4 100644
--- a/lncfg/dev_integration.go
+++ b/lncfg/dev_integration.go
@@ -5,6 +5,7 @@ package lncfg
import (
"time"
+ "github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/lnwallet/chanfunding"
)
@@ -27,6 +28,7 @@ type DevConfig struct {
UnsafeDisconnect bool `long:"unsafedisconnect" description:"Allows the rpcserver to intentionally disconnect from peers with open channels."`
MaxWaitNumBlocksFundingConf uint32 `long:"maxwaitnumblocksfundingconf" description:"Maximum blocks to wait for funding confirmation before discarding non-initiated channels."`
UnsafeConnect bool `long:"unsafeconnect" description:"Allow the rpcserver to connect to a peer even if there's already a connection."`
+ ForceChannelCloseConfs uint32 `long:"force-channel-close-confs" description:"Force a specific number of confirmations for channel closes (dev/test only)"`
}
// ChannelReadyWait returns the config value `ProcessChannelReadyWait`.
@@ -71,3 +73,13 @@ func (d *DevConfig) GetMaxWaitNumBlocksFundingConf() uint32 {
func (d *DevConfig) GetUnsafeConnect() bool {
return d.UnsafeConnect
}
+
+// ChannelCloseConfs returns the forced confirmation count if set, or None if
+// the default behavior should be used.
+func (d *DevConfig) ChannelCloseConfs() fn.Option[uint32] {
+ if d.ForceChannelCloseConfs == 0 {
+ return fn.None[uint32]()
+ }
+
+ return fn.Some(d.ForceChannelCloseConfs)
+}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.