lnd: github.com/lightningnetwork/lnd Index | Files | Directories

package lnd

import "github.com/lightningnetwork/lnd"

Index

Package Files

breacharbiter.go chainparams.go chainregistry.go channel_notifier.go chanrestore.go config.go doc.go fundingmanager.go lnd.go log.go mock.go nursery_store.go pilot.go rpcserver.go server.go subrpcserver_config.go test_utils.go utxonursery.go witness_beacon.go

Constants

const (

    // DefaultBitcoinBaseFeeMSat is the default forwarding base fee.
    DefaultBitcoinBaseFeeMSat = lnwire.MilliSatoshi(1000)

    // DefaultBitcoinFeeRate is the default forwarding fee rate.
    DefaultBitcoinFeeRate = lnwire.MilliSatoshi(1)

    // DefaultBitcoinTimeLockDelta is the default forwarding time lock
    // delta.
    DefaultBitcoinTimeLockDelta = 40
)
const (

    // MaxBtcFundingAmount is a soft-limit of the maximum channel size
    // currently accepted on the Bitcoin chain within the Lightning
    // Protocol. This limit is defined in BOLT-0002, and serves as an
    // initial precautionary limit while implementations are battle tested
    // in the real world.
    MaxBtcFundingAmount = btcutil.Amount(1<<24) - 1
)
const UnassignedConnID uint64 = 0

UnassignedConnID is the default connection ID that a request can have before it actually is submitted to the connmgr. TODO(conner): move into connmgr package, or better, add connmgr method for generating atomic IDs

Variables

var (
    // DefaultLndDir is the default directory where lnd tries to find its
    // configuration file and store its data. This is a directory in the
    // user's application data, for example:
    //   C:\Users\<username>\AppData\Local\Lnd on Windows
    //   ~/.lnd on Linux
    //   ~/Library/Application Support/Lnd on MacOS
    DefaultLndDir = btcutil.AppDataDir("lnd", false)

    // DefaultConfigFile is the default full path of lnd's configuration
    // file.
    DefaultConfigFile = filepath.Join(DefaultLndDir, lncfg.DefaultConfigFilename)
)
var (
    // MaxFundingAmount is a soft-limit of the maximum channel size
    // currently accepted within the Lightning Protocol. This limit is
    // defined in BOLT-0002, and serves as an initial precautionary limit
    // while implementations are battle tested in the real world.
    //
    // At the moment, this value depends on which chain is active. It is set
    // to the value under the Bitcoin chain as default.
    //
    // TODO(roasbeef): add command line param to modify
    MaxFundingAmount = MaxBtcFundingAmount

    // ErrFundingManagerShuttingDown is an error returned when attempting to
    // process a funding request/message but the funding manager has already
    // been signaled to shut down.
    ErrFundingManagerShuttingDown = errors.New("funding manager shutting " +
        "down")

    // ErrConfirmationTimeout is an error returned when we as a responder
    // are waiting for a funding transaction to confirm, but too many
    // blocks pass without confirmation.
    ErrConfirmationTimeout = errors.New("timeout waiting for funding " +
        "confirmation")
)
var (
    // ErrPeerNotConnected signals that the server has no connection to the
    // given peer.
    ErrPeerNotConnected = errors.New("peer is not connected")

    // ErrServerNotActive indicates that the server has started but hasn't
    // fully finished the startup process.
    ErrServerNotActive = errors.New("server is still in the process of " +
        "starting")

    // ErrServerShuttingDown indicates that the server is in the process of
    // gracefully exiting.
    ErrServerShuttingDown = errors.New("server is shutting down")
)
var (

    // ErrChannelNotFound is an error returned when a channel is not known
    // to us. In this case of the fundingManager, this error is returned
    // when the channel in question is not considered being in an opening
    // state.
    ErrChannelNotFound = fmt.Errorf("channel not found")
)
var (
    // ErrContractNotFound is returned when the nursery is unable to
    // retrieve information about a queried contract.
    ErrContractNotFound = fmt.Errorf("unable to locate contract")
)
var ErrImmatureChannel = errors.New("cannot remove immature channel, " +
    "still has ungraduated outputs")

ErrImmatureChannel signals a channel cannot be removed because not all of its outputs have graduated.

func AddSubLogger Uses

func AddSubLogger(root *build.RotatingLogWriter, subsystem string,
    useLoggers ...func(btclog.Logger))

AddSubLogger is a helper method to conveniently create and register the logger of one or more sub systems.

func AdminAuthOptions Uses

func AdminAuthOptions(cfg *Config) ([]grpc.DialOption, error)

AdminAuthOptions returns a list of DialOptions that can be used to authenticate with the RPC server with admin capabilities.

NOTE: This should only be called after the RPCListener has signaled it is ready.

func CleanAndExpandPath Uses

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 GetChanPointFundingTxid Uses

func GetChanPointFundingTxid(chanPoint *lnrpc.ChannelPoint) (*chainhash.Hash, error)

GetChanPointFundingTxid returns the given channel point's funding txid in raw bytes.

func Main Uses

func Main(cfg *Config, lisCfg ListenerCfg, shutdownChan <-chan struct{}) error

Main is the true entry point for lnd. It accepts a fully populated and validated main configuration struct and an optional listener config struct. This function starts all main system components then blocks until a signal is received on the shutdownChan at which point everything is shut down again.

func SetSubLogger Uses

func SetSubLogger(root *build.RotatingLogWriter, subsystem string,
    logger btclog.Logger, useLoggers ...func(btclog.Logger))

SetSubLogger is a helper method to conveniently register the logger of a sub system.

func SetupLoggers Uses

func SetupLoggers(root *build.RotatingLogWriter)

SetupLoggers initializes all package-global logger variables.

func WalletUnlockerAuthOptions Uses

func WalletUnlockerAuthOptions(cfg *Config) ([]grpc.DialOption, error)

WalletUnlockerAuthOptions returns a list of DialOptions that can be used to authenticate with the wallet unlocker service.

NOTE: This should only be called after the WalletUnlocker listener has signaled it is ready.

type BreachConfig Uses

type BreachConfig struct {
    // CloseLink allows the breach arbiter to shutdown any channel links for
    // which it detects a breach, ensuring now further activity will
    // continue across the link. The method accepts link's channel point and
    // a close type to be included in the channel close summary.
    CloseLink func(*wire.OutPoint, htlcswitch.ChannelCloseType)

    // DB provides access to the user's channels, allowing the breach
    // arbiter to determine the current state of a user's channels, and how
    // it should respond to channel closure.
    DB  *channeldb.DB

    // Estimator is used by the breach arbiter to determine an appropriate
    // fee level when generating, signing, and broadcasting sweep
    // transactions.
    Estimator chainfee.Estimator

    // GenSweepScript generates the receiving scripts for swept outputs.
    GenSweepScript func() ([]byte, error)

    // Notifier provides a publish/subscribe interface for event driven
    // notifications regarding the confirmation of txids.
    Notifier chainntnfs.ChainNotifier

    // PublishTransaction facilitates the process of broadcasting a
    // transaction to the network.
    PublishTransaction func(*wire.MsgTx, string) error

    // ContractBreaches is a channel where the breachArbiter will receive
    // notifications in the event of a contract breach being observed. A
    // ContractBreachEvent must be ACKed by the breachArbiter, such that
    // the sending subsystem knows that the event is properly handed off.
    ContractBreaches <-chan *ContractBreachEvent

    // Signer is used by the breach arbiter to generate sweep transactions,
    // which move coins from previously open channels back to the user's
    // wallet.
    Signer input.Signer

    // Store is a persistent resource that maintains information regarding
    // breached channels. This is used in conjunction with DB to recover
    // from crashes, restarts, or other failures.
    Store RetributionStore
}

BreachConfig bundles the required subsystems used by the breach arbiter. An instance of BreachConfig is passed to newBreachArbiter during instantiation.

type Config Uses

type Config struct {
    ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`

    LndDir       string `long:"lnddir" description:"The base directory that contains lnd's data, logs, configuration file, etc."`
    ConfigFile   string `short:"C" long:"configfile" description:"Path to configuration file"`
    DataDir      string `short:"b" long:"datadir" description:"The directory to store lnd's data within"`
    SyncFreelist bool   `long:"sync-freelist" description:"Whether the databases used within lnd should sync their freelist to disk. This is disabled by default resulting in improved memory performance during operation, but with an increase in startup time."`

    TLSCertPath     string   `long:"tlscertpath" description:"Path to write the TLS certificate for lnd's RPC and REST services"`
    TLSKeyPath      string   `long:"tlskeypath" description:"Path to write the TLS private key for lnd's RPC and REST services"`
    TLSExtraIPs     []string `long:"tlsextraip" description:"Adds an extra ip to the generated certificate"`
    TLSExtraDomains []string `long:"tlsextradomain" description:"Adds an extra domain to the generated certificate"`
    TLSAutoRefresh  bool     `long:"tlsautorefresh" description:"Re-generate TLS certificate and key if the IPs or domains are changed"`

    NoMacaroons     bool          `long:"no-macaroons" description:"Disable macaroon authentication"`
    AdminMacPath    string        `long:"adminmacaroonpath" description:"Path to write the admin macaroon for lnd's RPC and REST services if it doesn't exist"`
    ReadMacPath     string        `long:"readonlymacaroonpath" description:"Path to write the read-only macaroon for lnd's RPC and REST services if it doesn't exist"`
    InvoiceMacPath  string        `long:"invoicemacaroonpath" description:"Path to the invoice-only macaroon for lnd's RPC and REST services if it doesn't exist"`
    LogDir          string        `long:"logdir" description:"Directory to log output."`
    MaxLogFiles     int           `long:"maxlogfiles" description:"Maximum logfiles to keep (0 for no rotation)"`
    MaxLogFileSize  int           `long:"maxlogfilesize" description:"Maximum logfile size in MB"`
    AcceptorTimeout time.Duration `long:"acceptortimeout" description:"Time after which an RPCAcceptor will time out and return false if it hasn't yet received a response"`

    // We'll parse these 'raw' string arguments into real net.Addrs in the
    // loadConfig function. We need to expose the 'raw' strings so the
    // command line library can access them.
    // Only the parsed net.Addrs should be used!
    RawRPCListeners  []string `long:"rpclisten" description:"Add an interface/port/socket to listen for RPC connections"`
    RawRESTListeners []string `long:"restlisten" description:"Add an interface/port/socket to listen for REST connections"`
    RawListeners     []string `long:"listen" description:"Add an interface/port to listen for peer connections"`
    RawExternalIPs   []string `long:"externalip" description:"Add an ip:port to the list of local addresses we claim to listen on to peers. If a port is not specified, the default (9735) will be used regardless of other parameters"`
    ExternalHosts    []string `long:"externalhosts" description:"A set of hosts that should be periodically resolved to announce IPs for"`
    RPCListeners     []net.Addr
    RESTListeners    []net.Addr
    RestCORS         []string `long:"restcors" description:"Add an ip:port/hostname to allow cross origin access from. To allow all origins, set as \"*\"."`
    Listeners        []net.Addr
    ExternalIPs      []net.Addr
    DisableListen    bool          `long:"nolisten" description:"Disable listening for incoming peer connections"`
    DisableRest      bool          `long:"norest" description:"Disable REST API"`
    NAT              bool          `long:"nat" description:"Toggle NAT traversal support (using either UPnP or NAT-PMP) to automatically advertise your external IP address to the network -- NOTE this does not support devices behind multiple NATs"`
    MinBackoff       time.Duration `long:"minbackoff" description:"Shortest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."`
    MaxBackoff       time.Duration `long:"maxbackoff" description:"Longest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."`

    DebugLevel string `short:"d" long:"debuglevel" description:"Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify <subsystem>=<level>,<subsystem2>=<level>,... to set the log level for individual subsystems -- Use show to list available subsystems"`

    CPUProfile string `long:"cpuprofile" description:"Write CPU profile to the specified file"`

    Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65535"`

    UnsafeDisconnect   bool   `long:"unsafe-disconnect" description:"DEPRECATED: Allows the rpcserver to intentionally disconnect from peers with open channels. THIS FLAG WILL BE REMOVED IN 0.10.0"`
    UnsafeReplay       bool   `long:"unsafe-replay" description:"Causes a link to replay the adds on its commitment txn after starting up, this enables testing of the sphinx replay logic."`
    MaxPendingChannels int    `long:"maxpendingchannels" description:"The maximum number of incoming pending channels permitted per peer."`
    BackupFilePath     string `long:"backupfilepath" description:"The target location of the channel backup file"`

    Bitcoin      *lncfg.Chain    `group:"Bitcoin" namespace:"bitcoin"`
    BtcdMode     *lncfg.Btcd     `group:"btcd" namespace:"btcd"`
    BitcoindMode *lncfg.Bitcoind `group:"bitcoind" namespace:"bitcoind"`
    NeutrinoMode *lncfg.Neutrino `group:"neutrino" namespace:"neutrino"`

    Litecoin      *lncfg.Chain    `group:"Litecoin" namespace:"litecoin"`
    LtcdMode      *lncfg.Btcd     `group:"ltcd" namespace:"ltcd"`
    LitecoindMode *lncfg.Bitcoind `group:"litecoind" namespace:"litecoind"`

    Autopilot *lncfg.AutoPilot `group:"Autopilot" namespace:"autopilot"`

    Tor *lncfg.Tor `group:"Tor" namespace:"tor"`

    SubRPCServers *subRPCServerConfigs `group:"subrpc"`

    Hodl *hodl.Config `group:"hodl" namespace:"hodl"`

    NoNetBootstrap bool `long:"nobootstrap" description:"If true, then automatic network bootstrapping will not be attempted."`

    NoSeedBackup bool `long:"noseedbackup" description:"If true, NO SEED WILL BE EXPOSED AND THE WALLET WILL BE ENCRYPTED USING THE DEFAULT PASSPHRASE -- EVER. THIS FLAG IS ONLY FOR TESTING AND IS BEING DEPRECATED."`

    PaymentsExpirationGracePeriod time.Duration `long:"payments-expiration-grace-period" description:"A period to wait before force closing channels with outgoing htlcs that have timed-out and are a result of this node initiated payments."`
    TrickleDelay                  int           `long:"trickledelay" description:"Time in milliseconds between each release of announcements to the network"`
    ChanEnableTimeout             time.Duration `long:"chan-enable-timeout" description:"The duration that a peer connection must be stable before attempting to send a channel update to reenable or cancel a pending disables of the peer's channels on the network."`
    ChanDisableTimeout            time.Duration `long:"chan-disable-timeout" description:"The duration that must elapse after first detecting that an already active channel is actually inactive and sending channel update disabling it to the network. The pending disable can be canceled if the peer reconnects and becomes stable for chan-enable-timeout before the disable update is sent."`
    ChanStatusSampleInterval      time.Duration `long:"chan-status-sample-interval" description:"The polling interval between attempts to detect if an active channel has become inactive due to its peer going offline."`

    Alias       string `long:"alias" description:"The node alias. Used as a moniker by peers and intelligence services"`
    Color       string `long:"color" description:"The color of the node in hex format (i.e. '#3399FF'). Used to customize node appearance in intelligence services"`
    MinChanSize int64  `long:"minchansize" description:"The smallest channel size (in satoshis) that we should accept. Incoming channels smaller than this will be rejected"`

    NumGraphSyncPeers      int           `long:"numgraphsyncpeers" description:"The number of peers that we should receive new graph updates from. This option can be tuned to save bandwidth for light clients or routing nodes."`
    HistoricalSyncInterval time.Duration `long:"historicalsyncinterval" description:"The polling interval between historical graph sync attempts. Each historical graph sync attempt ensures we reconcile with the remote peer's graph from the genesis block."`

    IgnoreHistoricalGossipFilters bool `long:"ignore-historical-gossip-filters" description:"If true, will not reply with historical data that matches the range specified by a remote peer's gossip_timestamp_filter. Doing so will result in lower memory and bandwidth requirements."`

    RejectPush bool `long:"rejectpush" description:"If true, lnd will not accept channel opening requests with non-zero push amounts. This should prevent accidental pushes to merchant nodes."`

    RejectHTLC bool `long:"rejecthtlc" description:"If true, lnd will not forward any HTLCs that are meant as onward payments. This option will still allow lnd to send HTLCs and receive HTLCs but lnd won't be used as a hop."`

    StaggerInitialReconnect bool `long:"stagger-initial-reconnect" description:"If true, will apply a randomized staggering between 0s and 30s when reconnecting to persistent peers on startup. The first 10 reconnections will be attempted instantly, regardless of the flag's value"`

    MaxOutgoingCltvExpiry uint32 `long:"max-cltv-expiry" description:"The maximum number of blocks funds could be locked up for when forwarding payments."`

    MaxChannelFeeAllocation float64 `long:"max-channel-fee-allocation" description:"The maximum percentage of total funds that can be allocated to a channel's commitment fee. This only applies for the initiator of the channel. Valid values are within [0.1, 1]."`

    DryRunMigration bool `long:"dry-run-migration" description:"If true, lnd will abort committing a migration if it would otherwise have been successful. This leaves the database unmodified, and still compatible with the previously active version of lnd."`

    EnableUpfrontShutdown bool `long:"enable-upfront-shutdown" description:"If true, option upfront shutdown script will be enabled. If peers that we open channels with support this feature, we will automatically set the script to which cooperative closes should be paid out to on channel open. This offers the partial protection of a channel peer disconnecting from us if cooperative close is attempted with a different script."`

    AcceptKeySend bool `long:"accept-keysend" description:"If true, spontaneous payments through keysend will be accepted. [experimental]"`

    KeysendHoldTime time.Duration `long:"keysend-hold-time" description:"If non-zero, keysend payments are accepted but not immediately settled. If the payment isn't settled manually after the specified time, it is canceled automatically. [experimental]"`

    Routing *routing.Conf `group:"routing" namespace:"routing"`

    Workers *lncfg.Workers `group:"workers" namespace:"workers"`

    Caches *lncfg.Caches `group:"caches" namespace:"caches"`

    Prometheus lncfg.Prometheus `group:"prometheus" namespace:"prometheus"`

    WtClient *lncfg.WtClient `group:"wtclient" namespace:"wtclient"`

    Watchtower *lncfg.Watchtower `group:"watchtower" namespace:"watchtower"`

    ProtocolOptions *lncfg.ProtocolOptions `group:"protocol" namespace:"protocol"`

    AllowCircularRoute bool `long:"allow-circular-route" description:"If true, our node will allow htlc forwards that arrive and depart on the same channel."`

    DB  *lncfg.DB `group:"db" namespace:"db"`

    // LogWriter is the root logger that all of the daemon's subloggers are
    // hooked up to.
    LogWriter *build.RotatingLogWriter
    // contains filtered or unexported fields
}

Config defines the configuration options for lnd.

See LoadConfig for further details regarding the configuration loading+parsing process.

func DefaultConfig Uses

func DefaultConfig() Config

DefaultConfig returns all default values for the Config struct.

func LoadConfig Uses

func LoadConfig() (*Config, error)

LoadConfig initializes and parses the config using a config file and command line options.

The configuration proceeds as follows:

1) Start with a default config with sane settings
2) Pre-parse the command line to check for an alternative config file
3) Load configuration file overwriting defaults with any specified options
4) Parse CLI options and overwrite/add any specified options

func ValidateConfig Uses

func ValidateConfig(cfg Config, usageMessage string) (*Config, error)

ValidateConfig check the given configuration to be sane. This makes sure no illegal values or combination of values are set. All file system paths are normalized. The cleaned up config is returned on success.

type ContractBreachEvent Uses

type ContractBreachEvent struct {
    // ChanPoint is the channel point of the breached channel.
    ChanPoint wire.OutPoint

    // ProcessACK is an error channel where a nil error should be sent
    // iff the breach retribution info is safely stored in the retribution
    // store. In case storing the information to the store fails, a non-nil
    // error should be sent.
    ProcessACK chan error

    // BreachRetribution is the information needed to act on this contract
    // breach.
    BreachRetribution *lnwallet.BreachRetribution
}

ContractBreachEvent is an event the breachArbiter will receive in case a contract breach is observed on-chain. It contains the necessary information to handle the breach, and a ProcessACK channel we will use to ACK the event when we have safely stored all the necessary information.

type GrpcRegistrar Uses

type GrpcRegistrar interface {
    // RegisterGrpcSubserver is called for each net.Listener on which lnd
    // creates a grpc.Server instance. External subservers implementing this
    // method can then register their own gRPC server structs to the main
    // server instance.
    RegisterGrpcSubserver(*grpc.Server) error
}

GrpcRegistrar is an interface that must be satisfied by an external subserver that wants to be able to register its own gRPC server onto lnd's main grpc.Server instance.

type ListenerCfg Uses

type ListenerCfg struct {
    // WalletUnlocker can be set to the listener to use for the wallet
    // unlocker. If nil a regular network listener will be created.
    WalletUnlocker *ListenerWithSignal

    // RPCListener can be set to the listener to use for the RPC server. If
    // nil a regular network listener will be created.
    RPCListener *ListenerWithSignal
}

ListenerCfg is a wrapper around custom listeners that can be passed to lnd when calling its main method.

type ListenerWithSignal Uses

type ListenerWithSignal struct {
    net.Listener

    // Ready will be closed by the server listening on Listener.
    Ready chan struct{}

    // ExternalRPCSubserverCfg is optional and specifies the registration
    // callback and permissions to register external gRPC subservers.
    ExternalRPCSubserverCfg *RPCSubserverConfig

    // ExternalRestRegistrar is optional and specifies the registration
    // callback to register external REST subservers.
    ExternalRestRegistrar RestRegistrar
}

ListenerWithSignal is a net.Listener that has an additional Ready channel that will be closed when a server starts listening.

type NurseryConfig Uses

type NurseryConfig struct {
    // ChainIO is used by the utxo nursery to determine the current block
    // height, which drives the incubation of the nursery's outputs.
    ChainIO lnwallet.BlockChainIO

    // ConfDepth is the number of blocks the nursery store waits before
    // determining outputs in the chain as confirmed.
    ConfDepth uint32

    // FetchClosedChannels provides access to a user's channels, such that
    // they can be marked fully closed after incubation has concluded.
    FetchClosedChannels func(pendingOnly bool) (
        []*channeldb.ChannelCloseSummary, error)

    // FetchClosedChannel provides access to the close summary to extract a
    // height hint from.
    FetchClosedChannel func(chanID *wire.OutPoint) (
        *channeldb.ChannelCloseSummary, error)

    // Notifier provides the utxo nursery the ability to subscribe to
    // transaction confirmation events, which advance outputs through their
    // persistence state transitions.
    Notifier chainntnfs.ChainNotifier

    // PublishTransaction facilitates the process of broadcasting a signed
    // transaction to the appropriate network.
    PublishTransaction func(*wire.MsgTx, string) error

    // Store provides access to and modification of the persistent state
    // maintained about the utxo nursery's incubating outputs.
    Store NurseryStore

    // Sweep sweeps an input back to the wallet.
    SweepInput func(input.Input, sweep.Params) (chan sweep.Result, error)
}

NurseryConfig abstracts the required subsystems used by the utxo nursery. An instance of NurseryConfig is passed to newUtxoNursery during instantiation.

type NurseryStore Uses

type NurseryStore interface {
    // Incubate registers a set of CSV delayed outputs (incoming HTLC's on
    // our commitment transaction, or a commitment output), and a slice of
    // outgoing htlc outputs to be swept back into the user's wallet. The
    // event is persisted to disk, such that the nursery can resume the
    // incubation process after a potential crash.
    Incubate([]kidOutput, []babyOutput) error

    // CribToKinder atomically moves a babyOutput in the crib bucket to the
    // kindergarten bucket. Baby outputs are outgoing HTLC's which require
    // us to go to the second-layer to claim. The now mature kidOutput
    // contained in the babyOutput will be stored as it waits out the
    // kidOutput's CSV delay.
    CribToKinder(*babyOutput) error

    // PreschoolToKinder atomically moves a kidOutput from the preschool
    // bucket to the kindergarten bucket. This transition should be executed
    // after receiving confirmation of the preschool output. Incoming HTLC's
    // we need to go to the second-layer to claim, and also our commitment
    // outputs fall into this class.
    //
    // An additional parameter specifies the last graduated height. This is
    // used in case of late registration. It schedules the output for sweep
    // at the next epoch even though it has already expired earlier.
    PreschoolToKinder(kid *kidOutput, lastGradHeight uint32) error

    // GraduateKinder atomically moves an output at the provided height into
    // the graduated status. This involves removing the kindergarten entries
    // from both the height and channel indexes. The height bucket will be
    // opportunistically pruned from the height index as outputs are
    // removed.
    GraduateKinder(height uint32, output *kidOutput) error

    // FetchPreschools returns a list of all outputs currently stored in
    // the preschool bucket.
    FetchPreschools() ([]kidOutput, error)

    // FetchClass returns a list of kindergarten and crib outputs whose
    // timelocks expire at the given height.
    FetchClass(height uint32) ([]kidOutput, []babyOutput, error)

    // HeightsBelowOrEqual returns the lowest non-empty heights in the
    // height index, that exist at or below the provided upper bound.
    HeightsBelowOrEqual(height uint32) ([]uint32, error)

    // ForChanOutputs iterates over all outputs being incubated for a
    // particular channel point. This method accepts a callback that allows
    // the caller to process each key-value pair. The key will be a prefixed
    // outpoint, and the value will be the serialized bytes for an output,
    // whose type should be inferred from the key's prefix.
    ForChanOutputs(*wire.OutPoint, func([]byte, []byte) error) error

    // ListChannels returns all channels the nursery is currently tracking.
    ListChannels() ([]wire.OutPoint, error)

    // IsMatureChannel determines the whether or not all of the outputs in a
    // particular channel bucket have been marked as graduated.
    IsMatureChannel(*wire.OutPoint) (bool, error)

    // RemoveChannel channel erases all entries from the channel bucket for
    // the provided channel point, this method should only be called if
    // IsMatureChannel indicates the channel is ready for removal.
    RemoveChannel(*wire.OutPoint) error
}

NurseryStore abstracts the persistent storage layer for the utxo nursery. Concretely, it stores commitment and htlc outputs until any time-bounded constraints have fully matured. The store exposes methods for enumerating its contents, and persisting state transitions detected by the utxo nursery.

type RPCSubserverConfig Uses

type RPCSubserverConfig struct {
    // Registrar is a callback that is invoked for each net.Listener on
    // which lnd creates a grpc.Server instance.
    Registrar GrpcRegistrar

    // Permissions is the permissions required for the external subserver.
    // It is a map between the full HTTP URI of each RPC and its required
    // macaroon permissions. If multiple action/entity tuples are specified
    // per URI, they are all required. See rpcserver.go for a list of valid
    // action and entity values.
    Permissions map[string][]bakery.Op
}

RPCSubserverConfig is a struct that can be used to register an external subserver with the custom permissions that map to the gRPC server that is going to be registered with the GrpcRegistrar.

type RestRegistrar Uses

type RestRegistrar interface {
    // RegisterRestSubserver is called after lnd creates the main
    // proxy.ServeMux instance. External subservers implementing this method
    // can then register their own REST proxy stubs to the main server
    // instance.
    RegisterRestSubserver(context.Context, *proxy.ServeMux, string,
        []grpc.DialOption) error
}

RestRegistrar is an interface that must be satisfied by an external subserver that wants to be able to register its own REST mux onto lnd's main proxy.ServeMux instance.

type RetributionStore Uses

type RetributionStore interface {
    // Add persists the retributionInfo to disk, using the information's
    // chanPoint as the key. This method should overwrite any existing
    // entries found under the same key, and an error should be raised if
    // the addition fails.
    Add(retInfo *retributionInfo) error

    // IsBreached queries the retribution store to see if the breach arbiter
    // is aware of any breaches for the provided channel point.
    IsBreached(chanPoint *wire.OutPoint) (bool, error)

    // Finalize persists the finalized justice transaction for a particular
    // channel.
    Finalize(chanPoint *wire.OutPoint, finalTx *wire.MsgTx) error

    // GetFinalizedTxn loads the finalized justice transaction, if any, from
    // the retribution store. The finalized transaction will be nil if
    // Finalize has not yet been called for this channel point.
    GetFinalizedTxn(chanPoint *wire.OutPoint) (*wire.MsgTx, error)

    // Remove deletes the retributionInfo from disk, if any exists, under
    // the given key. An error should be re raised if the removal fails.
    Remove(key *wire.OutPoint) error

    // ForAll iterates over the existing on-disk contents and applies a
    // chosen, read-only callback to each. This method should ensure that it
    // immediately propagate any errors generated by the callback.
    ForAll(cb func(*retributionInfo) error) error
}

RetributionStore provides an interface for managing a persistent map from wire.OutPoint -> retributionInfo. Upon learning of a breach, a BreachArbiter should record the retributionInfo for the breached channel, which serves a checkpoint in the event that retribution needs to be resumed after failure. A RetributionStore provides an interface for managing the persisted set, as well as mapping user defined functions over the entire on-disk contents.

Calls to RetributionStore may occur concurrently. A concrete instance of RetributionStore should use appropriate synchronization primitives, or be otherwise safe for concurrent access.

type WalletUnlockParams Uses

type WalletUnlockParams struct {
    // Password is the public and private wallet passphrase.
    Password []byte

    // Birthday specifies the approximate time that this wallet was created.
    // This is used to bound any rescans on startup.
    Birthday time.Time

    // RecoveryWindow specifies the address lookahead when entering recovery
    // mode. A recovery will be attempted if this value is non-zero.
    RecoveryWindow uint32

    // Wallet is the loaded and unlocked Wallet. This is returned
    // from the unlocker service to avoid it being unlocked twice (once in
    // the unlocker service to check if the password is correct and again
    // later when lnd actually uses it). Because unlocking involves scrypt
    // which is resource intensive, we want to avoid doing it twice.
    Wallet *wallet.Wallet

    // ChansToRestore a set of static channel backups that should be
    // restored before the main server instance starts up.
    ChansToRestore walletunlocker.ChannelsToRecover
}

WalletUnlockParams holds the variables used to parameterize the unlocking of lnd's wallet after it has already been created.

Directories

PathSynopsis
aezeed
autopilot
brontide
buffer
build
cert
chainntnfs
chainntnfs/bitcoindnotify
chainntnfs/btcdnotify
chainntnfs/neutrinonotify
chanacceptor
chanbackup
chanfitnessPackage chanfitness monitors the behaviour of channels to provide insight into the health and performance of a channel.
channeldb
channeldb/kvdb
channeldb/migration
channeldb/migration_01_to_11
channeldb/migration12
channeldb/migration13
channeldb/migration16
channeldb/migtest
channelnotifier
clock
contractcourt
discovery
feature
htlcswitch
htlcswitch/hodl
htlcswitch/hop
input
invoices
keychain
labelsPackage labels contains labels used to label transactions broadcast by lnd.
lncfg
lnpeer
lnrpcPackage lnrpc is a reverse proxy.
lnrpc/autopilotrpcPackage autopilotrpc is a reverse proxy.
lnrpc/chainrpc
lnrpc/invoicesrpc
lnrpc/lnclipb
lnrpc/routerrpc
lnrpc/signrpc
lnrpc/verrpcPackage verrpc is a reverse proxy.
lnrpc/walletrpcPackage walletrpc is a reverse proxy.
lnrpc/watchtowerrpcPackage watchtowerrpc is a reverse proxy.
lnrpc/wtclientrpcPackage wtclientrpc is a reverse proxy.
lntestPackage lntest provides testing utilities for the lnd repository.
lntest/wait
lntypes
lnwallet
lnwallet/btcwallet
lnwallet/chainfee
lnwallet/chanfunding
lnwallet/chanvalidate
lnwire
macaroons
monitoring
multimutex
nat
netann
peernotifier
pool
queue
record
routing
routing/chainview
routing/localchans
routing/route
shachain
signal
subscribe
sweep
ticker
tlv
tor
walletunlocker
watchtower
watchtower/blob
watchtower/lookout
watchtower/wtclient
watchtower/wtdb
watchtower/wtmock
watchtower/wtpolicy
watchtower/wtserver
watchtower/wtwire
zpay32

Package lnd imports 131 packages (graph) and is imported by 5 packages. Updated 2020-07-09. Refresh now. Tools for package owners.