2015-12-26 21:35:15 +03:00
|
|
|
package channeldb
|
2016-03-24 08:11:57 +03:00
|
|
|
|
2019-03-27 23:06:57 +03:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
)
|
2016-03-24 08:11:57 +03:00
|
|
|
|
|
|
|
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")
|
|
|
|
|
2020-02-21 14:23:30 +03:00
|
|
|
// ErrNoHistoricalBucket is returned when the historical channel bucket
|
|
|
|
// not been created yet.
|
|
|
|
ErrNoHistoricalBucket = fmt.Errorf("historical channel bucket 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")
|
|
|
|
|
2020-05-22 01:37:39 +03:00
|
|
|
// ErrDuplicatePayAddr is returned when an invoice with the target
|
|
|
|
// payment addr already exists.
|
|
|
|
ErrDuplicatePayAddr = fmt.Errorf("invoice with payemnt addr already exists")
|
|
|
|
|
|
|
|
// ErrInvRefEquivocation is returned when an InvoiceRef targets
|
|
|
|
// multiple, distinct invoices.
|
|
|
|
ErrInvRefEquivocation = errors.New("inv ref matches multiple invoices")
|
|
|
|
|
2017-02-24 16:32:33 +03:00
|
|
|
// 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
|
|
|
|
2018-09-22 03:03:56 +03:00
|
|
|
// ErrChannelNotFound is returned when we attempt to locate a channel
|
|
|
|
// for a specific chain, but it is not found.
|
|
|
|
ErrChannelNotFound = fmt.Errorf("channel 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")
|
|
|
|
|
2019-03-27 23:06:57 +03:00
|
|
|
// ErrZombieEdge is an error returned when we attempt to look up an edge
|
|
|
|
// but it is marked as a zombie within the zombie index.
|
|
|
|
ErrZombieEdge = errors.New("edge marked as zombie")
|
|
|
|
|
2017-03-28 20:27:00 +03:00
|
|
|
// 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")
|
2019-01-12 20:59:44 +03:00
|
|
|
|
|
|
|
// ErrEdgePolicyOptionalFieldNotFound is an error returned if a channel
|
|
|
|
// policy field is not found in the db even though its message flags
|
|
|
|
// indicate it should be.
|
|
|
|
ErrEdgePolicyOptionalFieldNotFound = fmt.Errorf("optional field not " +
|
|
|
|
"present")
|
2018-12-10 06:28:54 +03:00
|
|
|
|
|
|
|
// ErrChanAlreadyExists is return when the caller attempts to create a
|
|
|
|
// channel with a channel point that is already present in the
|
|
|
|
// database.
|
|
|
|
ErrChanAlreadyExists = fmt.Errorf("channel already exists")
|
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)
|
|
|
|
}
|