multi: add new ChannelCloseConfs param, thread thru as needed

In this commit, we add a new param that'll allow us to scale up the
number of confirmations before we act on a new close. We'll use this
later to improve the current on chain handling logic.
This commit is contained in:
Olaoluwa Osuntokun committed 2026-01-15 16:22:26 -08:00
1 parent 622fa4476f
commit c0f48d23b4
4 files changed
+22

No files matched your search

+8
View File
@@ -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 {
+6
View File
@@ -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
+6
View File
@@ -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.
+2
View File
@@ -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,