2015-12-26 21:35:15 +03:00
|
|
|
package channeldb
|
2016-03-24 08:11:57 +03:00
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
var (
|
2017-02-24 16:32:33 +03:00
|
|
|
// ErrNoChanDBExists is returned when a channel bucket hasn't been
|
|
|
|
// created.
|
|
|
|
ErrNoChanDBExists = fmt.Errorf("channel db has not yet been created")
|
|
|
|
|
2018-08-03 02:45:03 +03:00
|
|
|
// ErrDBReversion is returned when detecting an attempt to revert to a
|
|
|
|
// prior database version.
|
|
|
|
ErrDBReversion = fmt.Errorf("channel db cannot revert to prior version")
|
|
|
|
|
2017-02-24 16:32:33 +03:00
|
|
|
// ErrLinkNodesNotFound is returned when node info bucket hasn't been
|
|
|
|
// created.
|
2016-12-14 07:48:49 +03:00
|
|
|
ErrLinkNodesNotFound = fmt.Errorf("no link nodes exist")
|
2016-06-23 02:17:19 +03:00
|
|
|
|
2017-02-24 16:32:33 +03:00
|
|
|
// ErrNoActiveChannels is returned when there is no active (open)
|
|
|
|
// channels within the database.
|
2016-06-21 07:39:50 +03:00
|
|
|
ErrNoActiveChannels = fmt.Errorf("no active channels exist")
|
2016-09-17 03:23:37 +03:00
|
|
|
|
2017-02-24 16:32:33 +03:00
|
|
|
// ErrNoPastDeltas is returned when the channel delta bucket hasn't been
|
|
|
|
// created.
|
|
|
|
ErrNoPastDeltas = fmt.Errorf("channel has no recorded deltas")
|
|
|
|
|
|
|
|
// ErrInvoiceNotFound is returned when a targeted invoice can't be
|
|
|
|
// found.
|
|
|
|
ErrInvoiceNotFound = fmt.Errorf("unable to locate invoice")
|
|
|
|
|
|
|
|
// ErrNoInvoicesCreated is returned when we don't have invoices in
|
|
|
|
// our database to return.
|
2016-09-19 21:46:48 +03:00
|
|
|
ErrNoInvoicesCreated = fmt.Errorf("there are no existing invoices")
|
2016-10-26 00:04:42 +03:00
|
|
|
|
2017-02-24 16:32:33 +03:00
|
|
|
// ErrDuplicateInvoice is returned when an invoice with the target
|
|
|
|
// payment hash already exists.
|
|
|
|
ErrDuplicateInvoice = fmt.Errorf("invoice with payment hash already exists")
|
|
|
|
|
|
|
|
// ErrNoPaymentsCreated is returned when bucket of payments hasn't been
|
|
|
|
// created.
|
2016-12-05 14:59:36 +03:00
|
|
|
ErrNoPaymentsCreated = fmt.Errorf("there are no existing payments")
|
|
|
|
|
2017-02-24 16:32:33 +03:00
|
|
|
// ErrNodeNotFound is returned when node bucket exists, but node with
|
|
|
|
// specific identity can't be found.
|
2016-10-26 00:04:42 +03:00
|
|
|
ErrNodeNotFound = fmt.Errorf("link node with target identity not found")
|
2017-02-24 16:32:33 +03:00
|
|
|
|
|
|
|
// ErrMetaNotFound is returned when meta bucket hasn't been
|
|
|
|
// created.
|
2016-12-08 09:47:01 +03:00
|
|
|
ErrMetaNotFound = fmt.Errorf("unable to locate meta information")
|
|
|
|
|
2017-02-24 16:32:33 +03:00
|
|
|
// ErrGraphNotFound is returned when at least one of the components of
|
|
|
|
// graph doesn't exist.
|
|
|
|
ErrGraphNotFound = fmt.Errorf("graph bucket not initialized")
|
|
|
|
|
|
|
|
// ErrGraphNeverPruned is returned when graph was never pruned.
|
|
|
|
ErrGraphNeverPruned = fmt.Errorf("graph never pruned")
|
|
|
|
|
2017-07-29 02:33:59 +03:00
|
|
|
// ErrSourceNodeNotSet is returned if the source node of the graph
|
2017-02-24 16:32:33 +03:00
|
|
|
// hasn't been added The source node is the center node within a
|
|
|
|
// star-graph.
|
|
|
|
ErrSourceNodeNotSet = fmt.Errorf("source node does not exist")
|
|
|
|
|
|
|
|
// ErrGraphNodesNotFound is returned in case none of the nodes has
|
|
|
|
// been added in graph node bucket.
|
2016-12-08 09:47:01 +03:00
|
|
|
ErrGraphNodesNotFound = fmt.Errorf("no graph nodes exist")
|
|
|
|
|
2017-02-24 16:32:33 +03:00
|
|
|
// ErrGraphNoEdgesFound is returned in case of none of the channel/edges
|
|
|
|
// has been added in graph edge bucket.
|
|
|
|
ErrGraphNoEdgesFound = fmt.Errorf("no graph edges exist")
|
|
|
|
|
|
|
|
// ErrGraphNodeNotFound is returned when we're unable to find the target
|
|
|
|
// node.
|
|
|
|
ErrGraphNodeNotFound = fmt.Errorf("unable to find node")
|
|
|
|
|
|
|
|
// ErrEdgeNotFound is returned when an edge for the target chanID
|
|
|
|
// can't be found.
|
2017-03-28 20:27:00 +03:00
|
|
|
ErrEdgeNotFound = fmt.Errorf("edge not found")
|
|
|
|
|
|
|
|
// ErrEdgeAlreadyExist is returned when edge with specific
|
|
|
|
// channel id can't be added because it already exist.
|
|
|
|
ErrEdgeAlreadyExist = fmt.Errorf("edge already exist")
|
2016-12-08 09:47:01 +03:00
|
|
|
|
2017-02-24 16:32:33 +03:00
|
|
|
// ErrNodeAliasNotFound is returned when alias for node can't be found.
|
2016-12-08 09:47:01 +03:00
|
|
|
ErrNodeAliasNotFound = fmt.Errorf("alias for node not found")
|
2017-02-17 12:29:23 +03:00
|
|
|
|
|
|
|
// ErrUnknownAddressType is returned when a node's addressType is not
|
|
|
|
// an expected value.
|
|
|
|
ErrUnknownAddressType = fmt.Errorf("address type cannot be resolved")
|
2017-05-05 01:21:56 +03:00
|
|
|
|
|
|
|
// ErrNoClosedChannels is returned when a node is queries for all the
|
|
|
|
// channels it has closed, but it hasn't yet closed any channels.
|
|
|
|
ErrNoClosedChannels = fmt.Errorf("no channel have been closed yet")
|
2018-02-28 09:05:58 +03:00
|
|
|
|
|
|
|
// ErrNoForwardingEvents is returned in the case that a query fails due
|
|
|
|
// to the log not having any recorded events.
|
|
|
|
ErrNoForwardingEvents = fmt.Errorf("no recorded forwarding events")
|
2016-03-24 08:11:57 +03:00
|
|
|
)
|
2018-09-05 03:01:20 +03:00
|
|
|
|
|
|
|
// ErrTooManyExtraOpaqueBytes creates an error which should be returned if the
|
|
|
|
// caller attempts to write an announcement message which bares too many extra
|
|
|
|
// opaque bytes. We limit this value in order to ensure that we don't waste
|
|
|
|
// disk space due to nodes unnecessarily padding out their announcements with
|
|
|
|
// garbage data.
|
|
|
|
func ErrTooManyExtraOpaqueBytes(numBytes int) error {
|
|
|
|
return fmt.Errorf("max allowed number of opaque bytes is %v, received "+
|
|
|
|
"%v bytes", MaxAllowedExtraOpaqueBytes, numBytes)
|
|
|
|
}
|