2023-06-14 06:14:17 +08:00
//go:build integration
package lncfg
2024-01-21 16:30:32 +00:00
import (
"time"
2024-02-21 13:20:19 -08:00
"github.com/lightningnetwork/lnd/lnwallet/chanfunding"
2024-01-21 16:30:32 +00:00
)
2023-06-14 06:14:17 +08:00
// IsDevBuild returns a bool to indicate whether we are in a development
// environment.
//
// NOTE: always return true here.
func IsDevBuild ( ) bool {
return true
}
// DevConfig specifies configs used for integration tests. These configs can
// only be used in tests and must NOT be exported for production usage.
//
2024-11-29 11:16:13 +02:00
//nolint:ll
2023-06-14 06:14:17 +08:00
type DevConfig struct {
ProcessChannelReadyWait time . Duration ` long:"processchannelreadywait" description:"Time to sleep before processing remote node's channel_ready message." `
2024-01-21 16:30:32 +00:00
ReservationTimeout time . Duration ` long:"reservationtimeout" description:"The maximum time we keep a pending channel open flow in memory." `
ZombieSweeperInterval time . Duration ` long:"zombiesweeperinterval" description:"The time interval at which channel opening flows are evaluated for zombie status." `
2024-01-31 17:13:38 +08:00
UnsafeDisconnect bool ` long:"unsafedisconnect" description:"Allows the rpcserver to intentionally disconnect from peers with open channels." `
2023-06-14 06:14:17 +08:00
}
// ChannelReadyWait returns the config value `ProcessChannelReadyWait`.
func ( d * DevConfig ) ChannelReadyWait ( ) time . Duration {
return d . ProcessChannelReadyWait
}
2024-01-21 16:30:32 +00:00
// GetReservationTimeout returns the config value for `ReservationTimeout`.
func ( d * DevConfig ) GetReservationTimeout ( ) time . Duration {
if d . ReservationTimeout == 0 {
2024-02-21 13:20:19 -08:00
return chanfunding . DefaultReservationTimeout
2024-01-21 16:30:32 +00:00
}
return d . ReservationTimeout
}
// GetZombieSweeperInterval returns the config value for`ZombieSweeperInterval`.
func ( d * DevConfig ) GetZombieSweeperInterval ( ) time . Duration {
if d . ZombieSweeperInterval == 0 {
return DefaultZombieSweeperInterval
}
return d . ZombieSweeperInterval
}
2024-01-31 17:13:38 +08:00
// ChannelReadyWait returns the config value `UnsafeDisconnect`.
func ( d * DevConfig ) GetUnsafeDisconnect ( ) bool {
return d . UnsafeDisconnect
}