multi: add new ChannelCloseConfs param, thread thru as needed
What changed, and why it matters
This commit adds a new internal setting called ChannelCloseConfs that lets developers override how many blockchain confirmations LND waits for before acting on a channel close. It is explicitly marked as only for dev/integration builds and testing. There is no actual logic change in this commit—it only threads the new parameter through several configuration structs so it can be used later.
No immediate action required. Treat as a preparatory refactor. Monitor follow-up commits that consume ChannelCloseConfs to ensure the override is gated behind dev builds and cannot be abused to reduce confirmation safety in production.
Security signals we found
New optional parameter for confirmation threshold override
Explicitly documented as dev/integration-build only
No functional logic change in this commit—pure plumbing
Touches on-chain resolution subsystem (contractcourt) and peer connection setup
Evidence from the diff
The change introduces an optional fn.Option[uint32] parameter named ChannelCloseConfs/chanCloseConfs in ChainArbitratorConfig, chainWatcherConfig, peer.Config, and server wiring. Comments state it overrides normal capacity-based scaling of confirmation requirements for channel closes and is restricted to dev/integration builds. The commit does not implement any override behavior; it merely propagates the value from server configuration down to chain arbitrator and peer components.
Changed components
contractcourt/chain_arbitrator.gocontractcourt/chain_watcher.gopeer/brontide.goserver.goInspect captured patch +22 / −0
diff --git a/contractcourt/chain_arbitrator.go b/contractcourt/chain_arbitrator.go
index 2e5f542..287c871 100644
--- a/contractcourt/chain_arbitrator.go
+++ b/contractcourt/chain_arbitrator.go
@@ -234,6 +234,12 @@ type ChainArbitratorConfig struct {
// AuxCloser is an optional interface that can be used to finalize
// cooperative channel closes.
AuxCloser fn.Option[AuxChanCloser]
+
+ // ChannelCloseConfs is an optional override for the number of
+ // confirmations required for channel closes. When set, this overrides
+ // the normal capacity-based scaling. This is only available in
+ // dev/integration builds for testing purposes.
+ ChannelCloseConfs fn.Option[uint32]
}
// ChainArbitrator is a sub-system that oversees the on-chain resolution of all
@@ -1143,6 +1149,7 @@ func (c *ChainArbitrator) WatchNewChannel(newChan *channeldb.OpenChannel) error
auxLeafStore: c.cfg.AuxLeafStore,
auxResolver: c.cfg.AuxResolver,
auxCloser: c.cfg.AuxCloser,
+ chanCloseConfs: c.cfg.ChannelCloseConfs,
},
)
if err != nil {
@@ -1321,6 +1328,7 @@ func (c *ChainArbitrator) loadOpenChannels() error {
auxLeafStore: c.cfg.AuxLeafStore,
auxResolver: c.cfg.AuxResolver,
auxCloser: c.cfg.AuxCloser,
+ chanCloseConfs: c.cfg.ChannelCloseConfs,
},
)
if err != nil {
diff --git a/contractcourt/chain_watcher.go b/contractcourt/chain_watcher.go
index 0b3a972..f2ef594 100644
--- a/contractcourt/chain_watcher.go
+++ b/contractcourt/chain_watcher.go
@@ -241,6 +241,12 @@ type chainWatcherConfig struct {
// auxCloser is used to finalize cooperative closes.
auxCloser fn.Option[AuxChanCloser]
+
+ // chanCloseConfs is an optional override for the number of
+ // confirmations required for channel closes. When set, this overrides
+ // the normal capacity-based scaling. This is only available in
+ // dev/integration builds for testing purposes.
+ chanCloseConfs fn.Option[uint32]
}
// chainWatcher is a system that's assigned to every active channel. The duty
diff --git a/peer/brontide.go b/peer/brontide.go
index 466c7d0..ac91f00 100644
--- a/peer/brontide.go
+++ b/peer/brontide.go
@@ -372,6 +372,12 @@ type Config struct {
// closure initiated by the remote peer.
CoopCloseTargetConfs uint32
+ // ChannelCloseConfs is an optional override for the number of
+ // confirmations required for channel closes. When set, this overrides
+ // the normal capacity-based scaling. This is only available in
+ // dev/integration builds for testing purposes.
+ ChannelCloseConfs fn.Option[uint32]
+
// ServerPubKey is the serialized, compressed public key of our lnd node.
// It is used to determine which policy (channel edge) to pass to the
// ChannelLink.
diff --git a/server.go b/server.go
index 508ffed..4e8ad03 100644
--- a/server.go
+++ b/server.go
@@ -1369,6 +1369,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
return c
},
)(implCfg.AuxChanCloser),
+ ChannelCloseConfs: s.cfg.Dev.ChannelCloseConfs(),
}, dbs.ChanStateDB)
// Select the configuration and funding parameters for Bitcoin.
@@ -4413,6 +4414,7 @@ func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
MaxOutgoingCltvExpiry: s.cfg.MaxOutgoingCltvExpiry,
MaxChannelFeeAllocation: s.cfg.MaxChannelFeeAllocation,
CoopCloseTargetConfs: s.cfg.CoopCloseTargetConfs,
+ ChannelCloseConfs: s.cfg.Dev.ChannelCloseConfs(),
MaxAnchorsCommitFeeRate: chainfee.SatPerKVByte(
s.cfg.MaxCommitFeeRateAnchors * 1000).FeePerKWeight(),
ChannelCommitInterval: s.cfg.ChannelCommitInterval,
Why this scored 18/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.