lncfg: add new dev config option for scaling channel close confs

This'll be useful for the set up upcoming itests.
This commit is contained in:
Olaoluwa Osuntokun 2025-10-01 16:40:13 -07:00
parent 931b54e848
commit 622fa4476f
2 changed files with 19 additions and 0 deletions

View file

@ -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]()
}

View file

@ -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)
}