package
0.2.1-alpha
Repository: https://github.com/bitlum/lnd.git
Documentation: pkg.go.dev

# README

channeldb

Build Status MIT licensed GoDoc

The channeldb implements the persistent storage engine for lnd and generically a data storage layer for the required state within the Lightning Network. The backing storage engine is boltdb, an embedded pure-go key-value store based off of LMDB.

The package implements an object-oriented storage model with queries and mutations flowing through a particular object instance rather than the database itself. The storage implemented by the objects includes: open channels, past commitment revocation states, the channel graph which includes authenticated node and channel announcements, outgoing payments, and invoices

Installation and Updating

$ go get -u github.com/lightningnetwork/lnd/channeldb

# Functions

DisableLog disables all library log output.
Open opens an existing channeldb.
SetLogWriter uses a specified io.Writer to output package logging info.
UseLogger uses a specified Logger to output package logging info.

# Constants

DualFunder represents a channel wherein both parties contribute funds towards the total capacity of the channel.
MaxMemoSize is maximum size of the memo field within invoices stored in the database.
MaxReceiptSize is the maximum size of the payment receipt stored within the database along side incoming/outgoing invoices.
SingleFunder represents a channel wherein one party solely funds the entire capacity of the channel.

# Variables

ErrDuplicateInvoice is returned when an invoice with the target payment hash already exists.
ErrEdgeAlreadyExist is returned when edge with specific channel id can't be added because it already exist.
ErrEdgeNotFound is returned when an edge for the target chanID can't be found.
ErrGraphNeverPruned is returned when graph was never pruned.
ErrGraphNodeNotFound is returned when we're unable to find the target node.
ErrGraphNodesNotFound is returned in case none of the nodes has been added in graph node bucket.
ErrGraphNoEdgesFound is returned in case of none of the channel/edges has been added in graph edge bucket.
ErrGraphNotFound is returned when at least one of the components of graph doesn't exist.
ErrInvoiceNotFound is returned when a targeted invoice can't be found.
ErrLinkNodesNotFound is returned when node info bucket hasn't been created.
ErrMetaNotFound is returned when meta bucket hasn't been created.
ErrNoActiveChannels is returned when there is no active (open) channels within the database.
ErrNoChanDBExists is returned when a channel bucket hasn't been created.
ErrNodeAliasNotFound is returned when alias for node can't be found.
ErrNodeNotFound is returned when node bucket exists, but node with specific identity can't be found.
ErrNoInvoicesCreated is returned when we don't have invoices in our database to return.
ErrNoPastDeltas is returned when the channel delta bucket hasn't been created.
ErrNoPaymentsCreated is returned when bucket of payments hasn't been created.
ErrSourceNodeNotSet is returned if the the source node of the graph hasn't been added The source node is the center node within a star-graph.
ErrUnknownAddressType is returned when a node's addressType is not an expected value.

# Structs

ChannelAuthProof is the authentication proof (the signature portion) for a channel.
ChannelDelta is a snapshot of the commitment state at a particular point in the commitment chain.
ChannelEdgeInfo represents a fully authenticated channel along with all its unique attributes.
ChannelEdgePolicy represents a *directed* edge within the channel graph.
ChannelGraph is a persistent, on-disk graph representation of the Lightning Network.
ChannelSnapshot is a frozen snapshot of the current channel state.
ContractTerm is a companion struct to the Invoice struct.
DB is the primary datastore for the lnd daemon.
HTLC is the on-disk representation of a hash time-locked contract.
Invoice is a payment invoice generated by a payee in order to request payment for some good or service.
LightningNode represents an individual vertex/node within the channel graph.
LinkNode stores metadata related to node's that we have/had a direct channel open with.
Meta structure holds the database meta information.
OpenChannel encapsulates the persistent and dynamic state of an open channel with a remote node.
OutgoingPayment represents a successful payment between the daemon and a remote node.

# Type aliases

ChannelType is an enum-like type that describes one of several possible channel types.