Documentation ¶
Index ¶
- Constants
- func CleanAndExpandPath(path string) string
- func ClientAddressDialer(defaultPort string) func(context.Context, string) (net.Conn, error)
- func EnforceSafeAuthentication(addrs []net.Addr, macaroonsActive bool) error
- func IsLoopback(addr string) bool
- func IsUnix(addr net.Addr) bool
- func ListenOnAddress(addr net.Addr) (net.Listener, error)
- func NormalizeAddresses(addrs []string, defaultPort string, tcpResolver TCPResolver) ([]net.Addr, error)
- func ParseAddressString(strAddress string, defaultPort string, tcpResolver TCPResolver) (net.Addr, error)
- func ParseLNAddressString(strAddress string, defaultPort string, tcpResolver TCPResolver) (*lnwire.NetAddress, error)
- func TLSListenOnAddress(addr net.Addr, config *tls.Config) (net.Listener, error)
- func Validate(validators ...Validator) error
- type AutoPilot
- type Bitcoind
- type Btcd
- type Caches
- type Chain
- type DB
- type DatabaseBackends
- type ExperimentalProtocol
- type LegacyProtocol
- type Neutrino
- type Prometheus
- type ProtocolOptions
- type TCPResolver
- type Tor
- type Validator
- type Watchtower
- type Workers
- type WtClient
Constants ¶
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 )
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 // 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 )
const ( BoltBackend = "bolt" EtcdBackend = "etcd" )
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 )
Variables ¶
This section is empty.
Functions ¶
func CleanAndExpandPath ¶
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 ¶
ClientAddressDialer creates a gRPC dialer that can also dial unix socket addresses instead of just TCP addresses.
func EnforceSafeAuthentication ¶
EnforceSafeAuthentication enforces "safe" authentication taking into account the interfaces that the RPC servers are listening on, and if macaroons are 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 IsLoopback ¶
IsLoopback returns true if an address describes a loopback interface.
func ListenOnAddress ¶
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 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 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 ¶
TLSListenOnAddress creates a TLS listener that listens on the given address.
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."` 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"` EstimateMode string `long:"estimatemode" description:"The fee estimate mode. Must be either ECONOMICAL or CONSERVATIVE."` }
Bitcoind holds the configuration options for the daemon's connection to bitcoind.
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 */ }
Caches holds the configuration for various caches within lnd.
type Chain ¶
type Chain struct { Active bool `long:"active" description:"If the chain should be active or not."` ChainDir string `long:"chaindir" description:"The directory to store the chain's data within."` Node string `` /* 141-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"` DefaultNumChanConfs int `` /* 197-byte string literal not displayed */ DefaultRemoteDelay int `` /* 248-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"` }
Chain holds the configuration options for the daemon's chain settings.
type DB ¶
type DB struct { Backend string `long:"backend" description:"The selected database backend."` Etcd *kvdb.EtcdConfig `group:"etcd" namespace:"etcd" description:"Etcd settings."` Bolt *kvdb.BoltConfig `group:"bolt" namespace:"bolt" description:"Bolt settings."` }
DB holds database configuration for LND.
func (*DB) GetBackends ¶
func (db *DB) GetBackends(ctx context.Context, dbPath string, networkName string) (*DatabaseBackends, error)
GetBackends returns a set of kvdb.Backends as set in the DB config. The local database will ALWAYS be non-nil, while the remote database will only be populated if etcd is specified.
type DatabaseBackends ¶
type DatabaseBackends struct { // LocalDB points to the local non-replicated backend. LocalDB kvdb.Backend // RemoteDB points to a possibly networked replicated backend. If no // replicated backend is active, then this pointer will be nil. RemoteDB kvdb.Backend }
DatabaseBackends is a two-tuple that holds the set of active database backends for the daemon. The two backends we expose are the local database backend, and the remote backend. The LocalDB attribute will always be populated. However, the remote DB will only be set if a replicated database is active.
type ExperimentalProtocol ¶
type ExperimentalProtocol struct { }
ExperimentalProtocol is a sub-config that houses any experimental protocol features that also require a build-tag to activate.
func (*ExperimentalProtocol) AnchorCommitments ¶
func (l *ExperimentalProtocol) AnchorCommitments() bool
AnchorCommitments returns true if support for the anchor commitment type should be signaled.
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 shuld 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."` FeeURL string `` /* 128-byte string literal not displayed */ AssertFilterHeader string `` /* 253-byte string literal not displayed */ }
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 shuld 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"` }
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) Wumbo ¶
func (l *ProtocolOptions) Wumbo() bool
Wumbo returns true if lnd should permit the creation and acceptance of wumbo channels.
type TCPResolver ¶
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."` 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"` 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.
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.
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."` // PrivateTowerURIs specifies the lightning URIs of the towers the // watchtower client should send new backups to. PrivateTowerURIs []string `` /* 263-byte string literal not displayed */ // 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 */ }
WtClient holds the configuration options for the daemon's watchtower client.