lncfg

package
v0.18.3-beta.rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinRejectCacheSize is a floor on the maximum capacity allowed for
	// channeldb's reject cache. This amounts to roughly 125 KB when full.
	MinRejectCacheSize = 5000

	// MinChannelCacheSize is a floor on the maximum capacity allowed for
	// channeldb's channel cache. This amounts to roughly 2 MB when full.
	MinChannelCacheSize = 1000

	// DefaultRPCGraphCacheDuration is the default interval that the RPC
	// response to DescribeGraph should be cached for.
	DefaultRPCGraphCacheDuration = time.Minute
)
View Source
const (
	// DefaultConfigFilename is the default configuration file name lnd
	// tries to load.
	DefaultConfigFilename = "lnd.conf"

	// DefaultMaxPendingChannels is the default maximum number of incoming
	// pending channels permitted per peer.
	DefaultMaxPendingChannels = 1

	// DefaultIncomingBroadcastDelta defines the number of blocks before the
	// expiry of an incoming htlc at which we force close the channel. We
	// only go to chain if we also have the preimage to actually pull in the
	// htlc. BOLT #2 suggests 7 blocks. We use a few more for extra safety.
	// Within this window we need to get our sweep or 2nd level success tx
	// confirmed, because after that the remote party is also able to claim
	// the htlc using the timeout path.
	DefaultIncomingBroadcastDelta = 10

	// DefaultFinalCltvRejectDelta defines the number of blocks before the
	// expiry of an incoming exit hop htlc at which we cancel it back
	// immediately. It is an extra safety measure over the final cltv
	// requirement as it is defined in the invoice. It ensures that we
	// cancel back htlcs that, when held on to, may cause us to force close
	// the channel because we enter the incoming broadcast window. Bolt #11
	// suggests 9 blocks here. We use a few more for additional safety.
	//
	// There is still a small gap that remains between receiving the
	// RevokeAndAck and canceling back. If a new block arrives within that
	// window, we may still force close the channel. There is currently no
	// way to reject an UpdateAddHtlc of which we already know that it will
	// push us in the broadcast window.
	DefaultFinalCltvRejectDelta = DefaultIncomingBroadcastDelta + 3

	// DefaultCltvInterceptDelta defines the number of blocks before the
	// expiry of the htlc where we don't intercept anymore. This value must
	// be greater than CltvRejectDelta, because we don't want to offer htlcs
	// to the interceptor client for which there is no time left to resolve
	// them anymore.
	DefaultCltvInterceptDelta = DefaultFinalCltvRejectDelta + 3

	// DefaultOutgoingBroadcastDelta defines the number of blocks before the
	// expiry of an outgoing htlc at which we force close the channel. We
	// are not in a hurry to force close, because there is nothing to claim
	// for us. We do need to time the htlc out, because there may be an
	// incoming htlc that will time out too (albeit later). Bolt #2 suggests
	// a value of -1 here, but we allow one block less to prevent potential
	// confusion around the negative value. It means we force close the
	// channel at exactly the htlc expiry height.
	DefaultOutgoingBroadcastDelta = 0

	// DefaultOutgoingCltvRejectDelta defines the number of blocks before
	// the expiry of an outgoing htlc at which we don't want to offer it to
	// the next peer anymore. If that happens, we cancel back the incoming
	// htlc. This is to prevent the situation where we have an outstanding
	// htlc that brings or will soon bring us inside the outgoing broadcast
	// window and trigger us to force close the channel. Bolt #2 suggests a
	// value of 0. We pad it a bit, to prevent a slow round trip to the next
	// peer and a block arriving during that round trip to trigger force
	// closure.
	DefaultOutgoingCltvRejectDelta = DefaultOutgoingBroadcastDelta + 3

	// DefaultZombieSweeperInterval is the default time interval at which
	// unfinished (zombiestate) open channel flows are purged from memory.
	DefaultZombieSweeperInterval = 1 * time.Minute
)
View Source
const (
	ChannelDBName     = "channel.db"
	MacaroonDBName    = "macaroons.db"
	DecayedLogDbName  = "sphinxreplay.db"
	TowerClientDBName = "wtclient.db"
	TowerServerDBName = "watchtower.db"
	WalletDBName      = "wallet.db"

	SqliteChannelDBName  = "channel.sqlite"
	SqliteChainDBName    = "chain.sqlite"
	SqliteNeutrinoDBName = "neutrino.sqlite"
	SqliteTowerDBName    = "watchtower.sqlite"
	SqliteNativeDBName   = "lnd.sqlite"

	BoltBackend                = "bolt"
	EtcdBackend                = "etcd"
	PostgresBackend            = "postgres"
	SqliteBackend              = "sqlite"
	DefaultBatchCommitInterval = 500 * time.Millisecond

	// NSChannelDB is the namespace name that we use for the combined graph
	// and channel state DB.
	NSChannelDB = "channeldb"

	// NSMacaroonDB is the namespace name that we use for the macaroon DB.
	NSMacaroonDB = "macaroondb"

	// NSDecayedLogDB is the namespace name that we use for the sphinx
	// replay a.k.a. decayed log DB.
	NSDecayedLogDB = "decayedlogdb"

	// NSTowerClientDB is the namespace name that we use for the watchtower
	// client DB.
	NSTowerClientDB = "towerclientdb"

	// NSTowerServerDB is the namespace name that we use for the watchtower
	// server DB.
	NSTowerServerDB = "towerserverdb"

	// NSWalletDB is the namespace name that we use for the wallet DB.
	NSWalletDB = "walletdb"

	// NSNeutrinoDB is the namespace name that we use for the neutrino DB.
	NSNeutrinoDB = "neutrinodb"
)
View Source
const (
	// DefaultHoldInvoiceExpiryDelta defines the number of blocks before the
	// expiry height of a hold invoice's htlc that lnd will automatically
	// cancel the invoice to prevent the channel from force closing. This
	// value *must* be greater than DefaultIncomingBroadcastDelta to prevent
	// force closes.
	DefaultHoldInvoiceExpiryDelta = DefaultIncomingBroadcastDelta + 2

	// DefaultMinNumRealBlindedPathHops is the minimum number of _real_
	// hops to include in a blinded payment path. This doesn't include our
	// node (the destination node), so if the minimum is 1, then the path
	// will contain at minimum our node along with an introduction node hop.
	DefaultMinNumRealBlindedPathHops = 1

	// DefaultNumBlindedPathHops is the number of hops to include in a
	// blinded payment path. If paths shorter than this number are found,
	// then dummy hops are used to pad the path to this length.
	DefaultNumBlindedPathHops = 2

	// DefaultMaxNumBlindedPaths is the maximum number of different blinded
	// payment paths to include in an invoice.
	DefaultMaxNumBlindedPaths = 3

	// DefaultBlindedPathPolicyIncreaseMultiplier is the default multiplier
	// used to increase certain blinded hop policy values in order to add
	// a probing buffer.
	DefaultBlindedPathPolicyIncreaseMultiplier = 1.1

	// DefaultBlindedPathPolicyDecreaseMultiplier is the default multiplier
	// used to decrease certain blinded hop policy values in order to add a
	// probing buffer.
	DefaultBlindedPathPolicyDecreaseMultiplier = 0.9
)
View Source
const (
	// MaxFeeRateFloor is the smallest config value allowed for the max fee
	// rate in sat/vb.
	MaxFeeRateFloor chainfee.SatPerVByte = 100

	// MaxAllowedFeeRate is the largest fee rate in sat/vb that we allow
	// when configuring the MaxFeeRate.
	MaxAllowedFeeRate = 10_000
)
View Source
const (
	// DefaultReadWorkers is the default maximum number of concurrent
	// workers used by the daemon's read pool.
	DefaultReadWorkers = 100

	// DefaultWriteWorkers is the default maximum number of concurrent
	// workers used by the daemon's write pool.
	DefaultWriteWorkers = 8

	// DefaultSigWorkers is the default maximum number of concurrent workers
	// used by the daemon's sig pool.
	DefaultSigWorkers = 8
)
View Source
const (
	// DefaultEtcdElectionPrefix is used as election prefix if none is provided
	// through the config.
	DefaultEtcdElectionPrefix = "/leader/"
)
View Source
const DefaultMaxUpdateTimeout = 20 * time.Minute

DefaultMaxUpdateTimeout represents the maximum interval in which a WebAPIEstimator will request fresh fees from its API.

View Source
const DefaultMinUpdateTimeout = 5 * time.Minute

DefaultMinUpdateTimeout represents the minimum interval in which a WebAPIEstimator will request fresh fees from its API.

View Source
const (
	// DefaultRemoteSignerRPCTimeout is the default timeout that is used
	// when forwarding a request to the remote signer through RPC.
	DefaultRemoteSignerRPCTimeout = 5 * time.Second
)
View Source
const (
	// DefaultTxPollingJitter defines the default TxPollingIntervalJitter
	// to be used for bitcoind backend.
	DefaultTxPollingJitter = 0.5
)
View Source
const Subsystem = "CNFG"

Subsystem defines the logging code for this subsystem.

Variables

View Source
var (
	// MinHealthCheckInterval is the minimum interval we allow between
	// health checks.
	MinHealthCheckInterval = time.Minute

	// MinHealthCheckTimeout is the minimum timeout we allow for health
	// check calls.
	MinHealthCheckTimeout = time.Second

	// MinHealthCheckBackoff is the minimum back off we allow between health
	// check retries.
	MinHealthCheckBackoff = time.Second
)
View Source
var (
	// MaxMailboxDeliveryTimeout specifies the max allowed timeout value.
	// This value is derived from the itest `async_bidirectional_payments`,
	// where both side send 483 payments at the same time to stress test
	// lnd.
	MaxMailboxDeliveryTimeout = 2 * time.Minute
)

Functions

func CleanAndExpandPath

func CleanAndExpandPath(path string) string

CleanAndExpandPath expands environment variables and leading ~ in the passed path, cleans the result, and returns it. This function is taken from https://github.com/btcsuite/btcd

func ClientAddressDialer

func ClientAddressDialer(defaultPort string) func(context.Context,
	string) (net.Conn, error)

ClientAddressDialer creates a gRPC dialer that can also dial unix socket addresses instead of just TCP addresses.

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func EnforceSafeAuthentication

func EnforceSafeAuthentication(addrs []net.Addr, macaroonsActive,
	tlsActive bool) error

EnforceSafeAuthentication enforces "safe" authentication taking into account the interfaces that the RPC servers are listening on, and if macaroons and TLS is activated or not. To protect users from using dangerous config combinations, we'll prevent disabling authentication if the server is listening on a public interface.

func GetPostgresConfigKVDB

func GetPostgresConfigKVDB(cfg *sqldb.PostgresConfig) *postgres.Config

GetPostgresConfigKVDB converts a sqldb.PostgresConfig to a kvdb postgres.Config.

func GetSqliteConfigKVDB

func GetSqliteConfigKVDB(cfg *sqldb.SqliteConfig) *sqlite.Config

GetSqliteConfigKVDB converts a sqldb.SqliteConfig to a kvdb sqlite.Config.

func IsDevBuild

func IsDevBuild() bool

IsDevBuild returns a bool to indicate whether we are in a development environment.

NOTE: always return false here.

func IsLoopback

func IsLoopback(host string) bool

IsLoopback returns true if an address describes a loopback interface.

func IsPrivate

func IsPrivate(addr net.Addr) bool

IsPrivate returns true if the address is private. The definitions are,

https://en.wikipedia.org/wiki/Link-local_address
https://en.wikipedia.org/wiki/Multicast_address
Local IPv4 addresses, https://tools.ietf.org/html/rfc1918
Local IPv6 addresses, https://tools.ietf.org/html/rfc4193

func IsUnix

func IsUnix(addr net.Addr) bool

IsUnix returns true if an address describes an Unix socket address.

func ListenOnAddress

func ListenOnAddress(addr net.Addr) (net.Listener, error)

ListenOnAddress creates a listener that listens on the given address.

func NormalizeAddresses

func NormalizeAddresses(addrs []string, defaultPort string,
	tcpResolver TCPResolver) ([]net.Addr, error)

NormalizeAddresses returns a new slice with all the passed addresses normalized with the given default port and all duplicates removed.

func NormalizeNetwork

func NormalizeNetwork(network string) string

NormalizeNetwork returns the common name of a network type used to create file paths. This allows differently versioned networks to use the same path.

func ParseAddressString

func ParseAddressString(strAddress string, defaultPort string,
	tcpResolver TCPResolver) (net.Addr, error)

ParseAddressString converts an address in string format to a net.Addr that is compatible with lnd. UDP is not supported because lnd needs reliable connections. We accept a custom function to resolve any TCP addresses so that caller is able control exactly how resolution is performed.

func ParseHexColor

func ParseHexColor(colorStr string) (color.RGBA, error)

ParseHexColor takes a hex string representation of a color in the form "#RRGGBB", parses the hex color values, and returns a color.RGBA struct of the same color.

func ParseLNAddressPubkey

func ParseLNAddressPubkey(strAddress string) (*btcec.PublicKey, string, error)

ParseLNAddressPubkey converts a string of the form <pubkey>@<addr> into two pieces: the pubkey bytes and an addr string. It validates that the pubkey is of a valid form.

func ParseLNAddressString

func ParseLNAddressString(strAddress string, defaultPort string,
	tcpResolver TCPResolver) (*lnwire.NetAddress, error)

ParseLNAddressString converts a string of the form <pubkey>@<addr> into an lnwire.NetAddress. The <pubkey> must be presented in hex, and result in a 33-byte, compressed public key that lies on the secp256k1 curve. The <addr> may be any address supported by ParseAddressString. If no port is specified, the defaultPort will be used. Any tcp addresses that need resolving will be resolved using the custom TCPResolver.

func TLSListenOnAddress

func TLSListenOnAddress(addr net.Addr,
	config *tls.Config) (net.Listener, error)

TLSListenOnAddress creates a TLS listener that listens on the given address.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

func Validate

func Validate(validators ...Validator) error

Validate accepts a variadic list of Validators and checks that each one passes its Validate method. An error is returned from the first Validator that fails.

Types

type AutoPilot

type AutoPilot struct {
	Active         bool               `long:"active" description:"If the autopilot agent should be active or not."`
	Heuristic      map[string]float64 `long:"heuristic" description:"Heuristic to activate, and the weight to give it during scoring."`
	MaxChannels    int                `long:"maxchannels" description:"The maximum number of channels that should be created"`
	Allocation     float64            `long:"allocation" description:"The percentage of total funds that should be committed to automatic channel establishment"`
	MinChannelSize int64              `long:"minchansize" description:"The smallest channel that the autopilot agent should create"`
	MaxChannelSize int64              `long:"maxchansize" description:"The largest channel that the autopilot agent should create"`
	Private        bool               `` /* 158-byte string literal not displayed */
	MinConfs       int32              `` /* 151-byte string literal not displayed */
	ConfTarget     uint32             `long:"conftarget" description:"The confirmation target (in blocks) for channels opened by autopilot."`
}

AutoPilot holds the configuration options for the daemon's autopilot.

type Bitcoind

type Bitcoind struct {
	Dir                  string        `long:"dir" description:"The base directory that contains the node's data, logs, configuration file, etc."`
	ConfigPath           string        `long:"config" description:"Configuration filepath. If not set, will default to the default filename under 'dir'."`
	RPCCookie            string        `` /* 127-byte string literal not displayed */
	RPCHost              string        `` /* 156-byte string literal not displayed */
	RPCUser              string        `long:"rpcuser" description:"Username for RPC connections"`
	RPCPass              string        `long:"rpcpass" default-mask:"-" description:"Password for RPC connections"`
	ZMQPubRawBlock       string        `long:"zmqpubrawblock" description:"The address listening for ZMQ connections to deliver raw block notifications"`
	ZMQPubRawTx          string        `long:"zmqpubrawtx" description:"The address listening for ZMQ connections to deliver raw transaction notifications"`
	ZMQReadDeadline      time.Duration `long:"zmqreaddeadline" description:"The read deadline for reading ZMQ messages from both the block and tx subscriptions"`
	EstimateMode         string        `long:"estimatemode" description:"The fee estimate mode. Must be either ECONOMICAL or CONSERVATIVE."`
	PrunedNodeMaxPeers   int           `` /* 175-byte string literal not displayed */
	RPCPolling           bool          `` /* 138-byte string literal not displayed */
	BlockPollingInterval time.Duration `` /* 138-byte string literal not displayed */
	TxPollingInterval    time.Duration `` /* 131-byte string literal not displayed */
}

Bitcoind holds the configuration options for the daemon's connection to bitcoind.

type BlindedPaths

type BlindedPaths struct {
	MinNumRealHops           uint8   `` /* 319-byte string literal not displayed */
	NumHops                  uint8   `` /* 294-byte string literal not displayed */
	MaxNumPaths              uint8   `long:"max-num-paths" description:"The maximum number of blinded paths to select and add to an invoice."`
	PolicyIncreaseMultiplier float64 `` /* 161-byte string literal not displayed */
	PolicyDecreaseMultiplier float64 `` /* 161-byte string literal not displayed */
}

BlindedPaths holds the configuration options for blinded path construction.

type Btcd

type Btcd struct {
	Dir        string `long:"dir" description:"The base directory that contains the node's data, logs, configuration file, etc."`
	RPCHost    string `` /* 156-byte string literal not displayed */
	RPCUser    string `long:"rpcuser" description:"Username for RPC connections"`
	RPCPass    string `long:"rpcpass" default-mask:"-" description:"Password for RPC connections"`
	RPCCert    string `long:"rpccert" description:"File containing the daemon's certificate file"`
	RawRPCCert string `` /* 146-byte string literal not displayed */
}

Btcd holds the configuration options for the daemon's connection to btcd.

type Caches

type Caches struct {
	// RejectCacheSize is the maximum number of entries stored in lnd's
	// reject cache, which is used for efficiently rejecting gossip updates.
	// Memory usage is roughly 25b per entry.
	RejectCacheSize int `` /* 222-byte string literal not displayed */

	// ChannelCacheSize is the maximum number of entries stored in lnd's
	// channel cache, which is used reduce memory allocations in reply to
	// peers querying for gossip traffic. Memory usage is roughly 2Kb per
	// entry.
	ChannelCacheSize int `` /* 205-byte string literal not displayed */

	// RPCGraphCacheDuration is used to control the flush interval of the
	// channel graph cache.
	RPCGraphCacheDuration time.Duration `` /* 167-byte string literal not displayed */
}

Caches holds the configuration for various caches within lnd.

func (*Caches) Validate

func (c *Caches) Validate() error

Validate checks the Caches configuration for values that are too small to be sane.

type Chain

type Chain struct {
	Active   bool   `` /* 159-byte string literal not displayed */
	ChainDir string `long:"chaindir" description:"The directory to store the chain's data within."`

	Node string `` /* 132-byte string literal not displayed */

	MainNet         bool     `long:"mainnet" description:"Use the main network"`
	TestNet3        bool     `long:"testnet" description:"Use the test network"`
	SimNet          bool     `long:"simnet" description:"Use the simulation test network"`
	RegTest         bool     `long:"regtest" description:"Use the regression test network"`
	SigNet          bool     `long:"signet" description:"Use the signet test network"`
	SigNetChallenge string   `` /* 188-byte string literal not displayed */
	SigNetSeedNode  []string `` /* 140-byte string literal not displayed */

	DefaultNumChanConfs int                 `` /* 197-byte string literal not displayed */
	DefaultRemoteDelay  int                 `` /* 248-byte string literal not displayed */
	MaxLocalDelay       uint16              `` /* 224-byte string literal not displayed */
	MinHTLCIn           lnwire.MilliSatoshi `long:"minhtlc" description:"The smallest HTLC we are willing to accept on our channels, in millisatoshi"`
	MinHTLCOut          lnwire.MilliSatoshi `long:"minhtlcout" description:"The smallest HTLC we are willing to send out on our channels, in millisatoshi"`
	BaseFee             lnwire.MilliSatoshi `long:"basefee" description:"The base fee in millisatoshi we will charge for forwarding payments on our channels"`
	FeeRate             lnwire.MilliSatoshi `` /* 191-byte string literal not displayed */
	TimeLockDelta       uint32              `long:"timelockdelta" description:"The CLTV delta we will subtract from a forwarded HTLC's timelock value"`
	DNSSeeds            []string            `` /* 325-byte string literal not displayed */
}

Chain holds the configuration options for the daemon's chain settings.

func (*Chain) Validate

func (c *Chain) Validate(minTimeLockDelta uint32, minDelay uint16) error

Validate performs validation on our chain config.

type CheckConfig

type CheckConfig struct {
	Interval time.Duration `long:"interval" description:"How often to run a health check."`

	Attempts int `` /* 132-byte string literal not displayed */

	Timeout time.Duration `long:"timeout" description:"The amount of time we allow the health check to take before failing due to timeout."`

	Backoff time.Duration `long:"backoff" description:"The amount of time to back-off between failed health checks."`
}

type Cluster

type Cluster struct {
	EnableLeaderElection bool `long:"enable-leader-election" description:"Enables leader election if set."`

	LeaderElector string `long:"leader-elector" choice:"etcd" description:"Leader elector to use. Valid values: \"etcd\"."`

	EtcdElectionPrefix string `long:"etcd-election-prefix" description:"Election key prefix when using etcd leader elector."`

	ID string `long:"id" description:"Identifier for this node inside the cluster (used in leader election). Defaults to the hostname."`

	LeaderSessionTTL int `long:"leader-session-ttl" description:"The TTL in seconds to use for the leader election session."`
}

Cluster holds configuration for clustered LND.

func DefaultCluster

func DefaultCluster() *Cluster

DefaultCluster creates and returns a new default DB config.

func (*Cluster) MakeLeaderElector

func (c *Cluster) MakeLeaderElector(electionCtx context.Context, db *DB) (
	cluster.LeaderElector, error)

MakeLeaderElector is a helper method to construct the concrete leader elector based on the current configuration.

func (*Cluster) Validate

func (c *Cluster) Validate() error

Validate validates the Cluster config.

type DB

type DB struct {
	Backend string `long:"backend" description:"The selected database backend."`

	BatchCommitInterval time.Duration `` /* 224-byte string literal not displayed */

	Etcd *etcd.Config `group:"etcd" namespace:"etcd" description:"Etcd settings."`

	Bolt *kvdb.BoltConfig `group:"bolt" namespace:"bolt" description:"Bolt settings."`

	Postgres *sqldb.PostgresConfig `group:"postgres" namespace:"postgres" description:"Postgres settings."`

	Sqlite *sqldb.SqliteConfig `group:"sqlite" namespace:"sqlite" description:"Sqlite settings."`

	UseNativeSQL bool `long:"use-native-sql" description:"Use native SQL for tables that already support it."`

	NoGraphCache bool `` /* 167-byte string literal not displayed */

	PruneRevocation bool `long:"prune-revocation" description:"Run the optional migration that prunes the revocation logs to save disk space."`

	NoRevLogAmtData bool `` /* 268-byte string literal not displayed */
}

DB holds database configuration for LND.

func DefaultDB

func DefaultDB() *DB

DefaultDB creates and returns a new default DB config.

func (*DB) GetBackends

func (db *DB) GetBackends(ctx context.Context, chanDBPath,
	walletDBPath, towerServerDBPath string, towerClientEnabled,
	towerServerEnabled bool, logger btclog.Logger) (*DatabaseBackends,
	error)

GetBackends returns a set of kvdb.Backends as set in the DB config.

func (*DB) Init

func (db *DB) Init(ctx context.Context, dbPath string) error

Init should be called upon start to pre-initialize database access dependent on configuration.

func (*DB) Validate

func (db *DB) Validate() error

Validate validates the DB config.

type DatabaseBackends

type DatabaseBackends struct {
	// GraphDB points to the database backend that contains the less
	// critical data that is accessed often, such as the channel graph and
	// chain height hints.
	GraphDB kvdb.Backend

	// ChanStateDB points to a possibly networked replicated backend that
	// contains the critical channel state related data.
	ChanStateDB kvdb.Backend

	// HeightHintDB points to a possibly networked replicated backend that
	// contains the chain height hint related data.
	HeightHintDB kvdb.Backend

	// MacaroonDB points to a database backend that stores the macaroon root
	// keys.
	MacaroonDB kvdb.Backend

	// DecayedLogDB points to a database backend that stores the decayed log
	// data.
	DecayedLogDB kvdb.Backend

	// TowerClientDB points to a database backend that stores the watchtower
	// client data. This might be nil if the watchtower client is disabled.
	TowerClientDB kvdb.Backend

	// TowerServerDB points to a database backend that stores the watchtower
	// server data. This might be nil if the watchtower server is disabled.
	TowerServerDB kvdb.Backend

	// WalletDB is an option that instructs the wallet loader where to load
	// the underlying wallet database from.
	WalletDB btcwallet.LoaderOption

	// NativeSQLStore is a pointer to a native SQL store that can be used
	// for native SQL queries for tables that already support it. This may
	// be nil if the use-native-sql flag was not set.
	NativeSQLStore *sqldb.BaseDB

	// Remote indicates whether the database backends are remote, possibly
	// replicated instances or local bbolt or sqlite backed databases.
	Remote bool

	// CloseFuncs is a map of close functions for each of the initialized
	// DB backends keyed by their namespace name.
	CloseFuncs map[string]func() error
}

DatabaseBackends is a two-tuple that holds the set of active database backends for the daemon. The two backends we expose are the graph database backend, and the channel state backend.

type DevConfig

type DevConfig struct{}

DevConfig specifies development configs used for production. This struct should always remain empty.

func (*DevConfig) ChannelReadyWait

func (d *DevConfig) ChannelReadyWait() time.Duration

ChannelReadyWait returns the config value, which is always 0 for production build.

func (*DevConfig) GetReservationTimeout

func (d *DevConfig) GetReservationTimeout() time.Duration

GetReservationTimeout returns the config value for `ReservationTimeout`.

func (*DevConfig) GetUnsafeDisconnect

func (d *DevConfig) GetUnsafeDisconnect() bool

GetUnsafeDisconnect returns the config value, which is always true for production build.

TODO(yy): this is a temporary solution to allow users to reconnect peers to trigger a reestablishiment for the active channels. Once a new dedicated RPC is added to realize that functionality, this function should return false to forbidden disconnecting peers while there are active channels.

func (*DevConfig) GetZombieSweeperInterval

func (d *DevConfig) GetZombieSweeperInterval() time.Duration

GetZombieSweeperInterval returns the config value for`ZombieSweeperInterval`.

type DiskCheckConfig

type DiskCheckConfig struct {
	RequiredRemaining float64 `` /* 135-byte string literal not displayed */

	*CheckConfig
}

DiskCheckConfig contains configuration for ensuring that our node has sufficient disk space.

type ExperimentalProtocol

type ExperimentalProtocol struct {
}

ExperimentalProtocol is a sub-config that houses any experimental protocol features that also require a build-tag to activate.

type Fee

type Fee struct {
	URL              string        `` /* 204-byte string literal not displayed */
	MinUpdateTimeout time.Duration `long:"min-update-timeout" description:"The minimum interval in which fees will be updated from the specified fee URL."`
	MaxUpdateTimeout time.Duration `long:"max-update-timeout" description:"The maximum interval in which fees will be updated from the specified fee URL."`
}

Fee holds the configuration options for fee estimation.

type Gossip

type Gossip struct {
	PinnedSyncersRaw []string `` /* 421-byte string literal not displayed */

	PinnedSyncers discovery.PinnedSyncers

	MaxChannelUpdateBurst int `` /* 167-byte string literal not displayed */

	ChannelUpdateInterval time.Duration `` /* 163-byte string literal not displayed */

	SubBatchDelay time.Duration `` /* 213-byte string literal not displayed */
}

func (*Gossip) Parse

func (g *Gossip) Parse() error

Parse the pubkeys for the pinned syncers.

type HealthCheckConfig

type HealthCheckConfig struct {
	ChainCheck *CheckConfig `group:"chainbackend" namespace:"chainbackend"`

	DiskCheck *DiskCheckConfig `group:"diskspace" namespace:"diskspace"`

	TLSCheck *CheckConfig `group:"tls" namespace:"tls"`

	TorConnection *CheckConfig `group:"torconnection" namespace:"torconnection"`

	RemoteSigner *CheckConfig `group:"remotesigner" namespace:"remotesigner"`

	LeaderCheck *CheckConfig `group:"leader" namespace:"leader"`
}

HealthCheckConfig contains the configuration for the different health checks the lnd runs.

func (*HealthCheckConfig) Validate

func (h *HealthCheckConfig) Validate() error

Validate checks the values configured for our health checks.

type Htlcswitch

type Htlcswitch struct {
	MailboxDeliveryTimeout time.Duration `` /* 227-byte string literal not displayed */
}

func (*Htlcswitch) Validate

func (h *Htlcswitch) Validate() error

Validate checks the values configured for htlcswitch.

type Invoices

type Invoices struct {
	HoldExpiryDelta uint32 `` /* 256-byte string literal not displayed */
}

Invoices holds the configuration options for invoices.

func (*Invoices) Validate

func (i *Invoices) Validate() error

Validate checks that the various invoice config options are sane.

NOTE: this is part of the Validator interface.

type LegacyProtocol

type LegacyProtocol struct {
}

Legacy is a sub-config that houses all the legacy protocol options. These are mostly used for integration tests as most modern nodes should always run with them on by default.

func (*LegacyProtocol) LegacyOnion

func (l *LegacyProtocol) LegacyOnion() bool

LegacyOnion returns true if the old legacy onion format should be used when we're an intermediate or final hop. This controls if we set the TLVOnionPayloadOptional bit or not.

func (*LegacyProtocol) NoStaticRemoteKey

func (l *LegacyProtocol) NoStaticRemoteKey() bool

NoStaticRemoteKey returns true if the old commitment format with a tweaked remote key should be used for new funded channels.

type Neutrino

type Neutrino struct {
	AddPeers           []string      `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"`
	ConnectPeers       []string      `long:"connect" description:"Connect only to the specified peers at startup"`
	MaxPeers           int           `long:"maxpeers" description:"Max number of inbound and outbound peers"`
	BanDuration        time.Duration `long:"banduration" description:"How long to ban misbehaving peers.  Valid time units are {s, m, h}.  Minimum 1 second"`
	BanThreshold       uint32        `long:"banthreshold" description:"Maximum allowed ban score before disconnecting and banning misbehaving peers."`
	AssertFilterHeader string        `` /* 253-byte string literal not displayed */
	UserAgentName      string        `long:"useragentname" description:"Used to help identify ourselves to other bitcoin peers"`
	UserAgentVersion   string        `long:"useragentversion" description:"Used to help identify ourselves to other bitcoin peers"`
	ValidateChannels   bool          `` /* 458-byte string literal not displayed */
	BroadcastTimeout   time.Duration `long:"broadcasttimeout" description:"The amount of time to wait before giving up on a transaction broadcast attempt."`
	PersistFilters     bool          `long:"persistfilters" description:"Whether compact filters fetched from the P2P network should be persisted to disk."`
}

Neutrino holds the configuration options for the daemon's connection to neutrino.

type Prometheus

type Prometheus struct{}

Prometheus configures the Prometheus exporter when monitoring is enabled. Monitoring is currently disabled.

func DefaultPrometheus

func DefaultPrometheus() Prometheus

DefaultPrometheus is the default configuration for the Prometheus metrics exporter when monitoring is enabled. Monitoring is currently disabled.

func (*Prometheus) Enabled

func (p *Prometheus) Enabled() bool

Enabled returns whether or not Prometheus monitoring is enabled. Monitoring is currently disabled, so Enabled will always return false.

type ProtocolOptions

type ProtocolOptions struct {
	// LegacyProtocol is a sub-config that houses all the legacy protocol
	// options.  These are mostly used for integration tests as most modern
	// nodes should always run with them on by default.
	LegacyProtocol `group:"legacy" namespace:"legacy"`

	// ExperimentalProtocol is a sub-config that houses any experimental
	// protocol features that also require a build-tag to activate.
	ExperimentalProtocol

	// WumboChans should be set if we want to enable support for wumbo
	// (channels larger than 0.16 BTC) channels, which is the opposite of
	// mini.
	WumboChans bool `long:"wumbo-channels" description:"if set, then lnd will create and accept requests for channels larger chan 0.16 BTC"`

	// TaprootChans should be set if we want to enable support for the
	// experimental simple taproot chans commitment type.
	TaprootChans bool `` /* 144-byte string literal not displayed */

	// NoAnchors should be set if we don't want to support opening or accepting
	// channels having the anchor commitment type.
	NoAnchors bool `long:"no-anchors" description:"disable support for anchor commitments"`

	// NoScriptEnforcedLease should be set if we don't want to support
	// opening or accepting channels having the script enforced commitment
	// type for leased channel.
	NoScriptEnforcedLease bool `long:"no-script-enforced-lease" description:"disable support for script enforced lease commitments"`

	// OptionScidAlias should be set if we want to signal the
	// option-scid-alias feature bit. This allows scid aliases and the
	// option-scid-alias channel-type.
	OptionScidAlias bool `long:"option-scid-alias" description:"enable support for option_scid_alias channels"`

	// OptionZeroConf should be set if we want to signal the zero-conf
	// feature bit.
	OptionZeroConf bool `long:"zero-conf" description:"enable support for zero-conf channels, must have option-scid-alias set also"`

	// NoOptionAnySegwit should be set to true if we don't want to use any
	// Taproot (and beyond) addresses for co-op closing.
	NoOptionAnySegwit bool `long:"no-any-segwit" description:"disallow using any segwit witness version as a co-op close address"`

	// NoTimestampQueryOption should be set to true if we don't want our
	// syncing peers to also send us the timestamps of announcement messages
	// when we send them a channel range query. Setting this to true will
	// also mean that we won't respond with timestamps if requested by our
	// peers.
	NoTimestampQueryOption bool `` /* 149-byte string literal not displayed */

	// NoRouteBlindingOption disables forwarding of payments in blinded routes.
	NoRouteBlindingOption bool `long:"no-route-blinding" description:"do not forward payments that are a part of a blinded route"`

	// CustomMessage allows the custom message APIs to handle messages with
	// the provided protocol numbers, which fall outside the custom message
	// number range.
	CustomMessage []uint16 `` /* 182-byte string literal not displayed */

	// CustomInit specifies feature bits to advertise in the node's init
	// message.
	CustomInit []uint16 `` /* 126-byte string literal not displayed */

	// CustomNodeAnn specifies custom feature bits to advertise in the
	// node's announcement message.
	CustomNodeAnn []uint16 `` /* 137-byte string literal not displayed */

	// CustomInvoice specifies custom feature bits to advertise in the
	// node's invoices.
	CustomInvoice []uint16 `long:"custom-invoice" description:"custom feature bits — numbers defined in BOLT 9 — to advertise in the node's invoices"`
}

ProtocolOptions is a struct that we use to be able to test backwards compatibility of protocol additions, while defaulting to the latest within lnd, or to enable experimental protocol changes.

func (ProtocolOptions) CustomFeatures

func (p ProtocolOptions) CustomFeatures() map[feature.Set][]lnwire.FeatureBit

CustomFeatures returns a custom set of feature bits to advertise.

func (ProtocolOptions) CustomMessageOverrides

func (p ProtocolOptions) CustomMessageOverrides() []uint16

CustomMessageOverrides returns the set of protocol messages that we override to allow custom handling.

func (*ProtocolOptions) NoAnchorCommitments

func (l *ProtocolOptions) NoAnchorCommitments() bool

NoAnchorCommitments returns true if we have disabled support for the anchor commitment type.

func (*ProtocolOptions) NoAnySegwit

func (l *ProtocolOptions) NoAnySegwit() bool

NoAnySegwit returns true if we don't signal that we understand other newer segwit witness versions for co-op close addresses.

func (*ProtocolOptions) NoRouteBlinding

func (l *ProtocolOptions) NoRouteBlinding() bool

NoRouteBlinding returns true if forwarding of blinded payments is disabled.

func (*ProtocolOptions) NoScriptEnforcementLease

func (l *ProtocolOptions) NoScriptEnforcementLease() bool

NoScriptEnforcementLease returns true if we have disabled support for the script enforcement commitment type for leased channels.

func (*ProtocolOptions) NoTimestampsQuery

func (l *ProtocolOptions) NoTimestampsQuery() bool

NoTimestampsQuery returns true if we should not ask our syncing peers to also send us the timestamps of announcement messages when we send them a channel range query, and it also means that we will not respond with timestamps if requested by our peer.

func (*ProtocolOptions) ScidAlias

func (l *ProtocolOptions) ScidAlias() bool

ScidAlias returns true if we have enabled the option-scid-alias feature bit.

func (*ProtocolOptions) Wumbo

func (l *ProtocolOptions) Wumbo() bool

Wumbo returns true if lnd should permit the creation and acceptance of wumbo channels.

func (*ProtocolOptions) ZeroConf

func (l *ProtocolOptions) ZeroConf() bool

ZeroConf returns true if we have enabled the zero-conf feature bit.

type RPCMiddleware

type RPCMiddleware struct {
	Enable           bool          `long:"enable" description:"Enable the RPC middleware interceptor functionality."`
	InterceptTimeout time.Duration `` /* 161-byte string literal not displayed */
	Mandatory        []string      `` /* 220-byte string literal not displayed */
}

RPCMiddleware holds the configuration for RPC interception middleware.

func DefaultRPCMiddleware

func DefaultRPCMiddleware() *RPCMiddleware

DefaultRPCMiddleware returns the default values for the RPC interception middleware configuration.

func (*RPCMiddleware) Validate

func (r *RPCMiddleware) Validate() error

Validate checks the values configured for the RPC middleware.

type RemoteSigner

type RemoteSigner struct {
	Enable           bool          `` /* 274-byte string literal not displayed */
	RPCHost          string        `long:"rpchost" description:"The remote signer's RPC host:port"`
	MacaroonPath     string        `long:"macaroonpath" description:"The macaroon to use for authenticating with the remote signer"`
	TLSCertPath      string        `long:"tlscertpath" description:"The TLS certificate to use for establishing the remote signer's identity"`
	Timeout          time.Duration `` /* 135-byte string literal not displayed */
	MigrateWatchOnly bool          `` /* 337-byte string literal not displayed */
}

RemoteSigner holds the configuration options for a remote RPC signer.

func (*RemoteSigner) Validate

func (r *RemoteSigner) Validate() error

Validate checks the values configured for our remote RPC signer.

type Routing

type Routing struct {
	AssumeChannelValid bool `` /* 224-byte string literal not displayed */

	StrictZombiePruning bool `` /* 197-byte string literal not displayed */

	BlindedPaths BlindedPaths `group:"blinding" namespace:"blinding"`
}

Routing holds the configuration options for routing.

func (*Routing) Validate

func (r *Routing) Validate() error

Validate checks that the various routing config options are sane.

NOTE: this is part of the Validator interface.

type Sweeper

type Sweeper struct {
	BatchWindowDuration time.Duration        `` /* 207-byte string literal not displayed */
	MaxFeeRate          chainfee.SatPerVByte `` /* 313-byte string literal not displayed */

	NoDeadlineConfTarget uint32 `` /* 209-byte string literal not displayed */

	Budget *contractcourt.BudgetConfig `` /* 369-byte string literal not displayed */
}

func DefaultSweeperConfig

func DefaultSweeperConfig() *Sweeper

DefaultSweeperConfig returns the default configuration for the sweeper.

func (*Sweeper) Validate

func (s *Sweeper) Validate() error

Validate checks the values configured for the sweeper.

type TCPResolver

type TCPResolver = func(network, addr string) (*net.TCPAddr, error)

TCPResolver is a function signature that resolves an address on a given network.

type Tor

type Tor struct {
	Active                      bool   `long:"active" description:"Allow outbound and inbound connections to be routed through Tor"`
	SOCKS                       string `long:"socks" description:"The host:port that Tor's exposed SOCKS5 proxy is listening on"`
	DNS                         string `` /* 126-byte string literal not displayed */
	StreamIsolation             bool   `long:"streamisolation" description:"Enable Tor stream isolation by randomizing user credentials for each connection."`
	SkipProxyForClearNetTargets bool   `` /* 135-byte string literal not displayed */
	Control                     string `long:"control" description:"The host:port that Tor is listening on for Tor control connections"`
	TargetIPAddress             string `long:"targetipaddress" description:"IP address that Tor should use as the target of the hidden service"`
	Password                    string `` /* 206-byte string literal not displayed */
	V2                          bool   `long:"v2" description:"Automatically set up a v2 onion service to listen for inbound connections"`
	V3                          bool   `long:"v3" description:"Automatically set up a v3 onion service to listen for inbound connections"`
	PrivateKeyPath              string `long:"privatekeypath" description:"The path to the private key of the onion service being created"`
	EncryptKey                  bool   `long:"encryptkey" description:"Encrypts the Tor private key file on disk"`
	WatchtowerKeyPath           string `long:"watchtowerkeypath" description:"The path to the private key of the watchtower onion service being created"`
}

Tor holds the configuration options for the daemon's connection to tor.

type Validator

type Validator interface {
	// Validate returns an error if a particular configuration is invalid or
	// insane.
	Validate() error
}

Validator is a generic interface for validating sub configurations.

type Watchtower

type Watchtower struct {
	Active bool `long:"active" description:"If the watchtower should be active or not"`

	TowerDir string `long:"towerdir" description:"Directory of the watchtower.db"`

	watchtower.Conf
}

Watchtower holds the daemon specific configuration parameters for running a watchtower that shares resources with the daemon.

func DefaultWatchtowerCfg

func DefaultWatchtowerCfg(defaultTowerDir string) *Watchtower

DefaultWatchtowerCfg creates a Watchtower with some default values filled out.

type Workers

type Workers struct {
	// Read is the maximum number of concurrent read pool workers.
	Read int `` /* 132-byte string literal not displayed */

	// Write is the maximum number of concurrent write pool workers.
	Write int `` /* 146-byte string literal not displayed */

	// Sig is the maximum number of concurrent sig pool workers.
	Sig int `` /* 141-byte string literal not displayed */
}

Workers exposes CLI configuration for turning resources consumed by worker pools.

func (*Workers) Validate

func (w *Workers) Validate() error

Validate checks the Workers configuration to ensure that the input values are sane.

type WtClient

type WtClient struct {
	// Active determines whether a watchtower client should be created to
	// back up channel states with registered watchtowers.
	Active bool `long:"active" description:"Whether the daemon should use private watchtowers to back up revoked channel states."`

	// SweepFeeRate specifies the fee rate in sat/byte to be used when
	// constructing justice transactions sent to the tower.
	SweepFeeRate uint64 `` /* 144-byte string literal not displayed */

	// SessionCloseRange is the range over which to choose a random number
	// of blocks to wait after the last channel of a session is closed
	// before sending the DeleteSession message to the tower server.
	SessionCloseRange uint32 `` /* 236-byte string literal not displayed */

	// MaxTasksInMemQueue is the maximum number of back-up tasks that should
	// be queued in memory before overflowing to disk.
	MaxTasksInMemQueue uint64 `` /* 133-byte string literal not displayed */

	// MaxUpdates is the maximum number of updates to be backed up in a
	// single tower sessions.
	MaxUpdates uint16 `long:"max-updates" description:"The maximum number of updates to be backed up in a single session."`
}

WtClient holds the configuration options for the daemon's watchtower client.

func DefaultWtClientCfg

func DefaultWtClientCfg() *WtClient

DefaultWtClientCfg returns the WtClient config struct with some default values populated.

func (*WtClient) Validate

func (c *WtClient) Validate() error

Validate ensures the user has provided a valid configuration.

NOTE: Part of the Validator interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL