github.com/decred/dcrlnd@v0.7.6/channeldb/error.go (about) 1 package channeldb 2 3 import ( 4 "errors" 5 "fmt" 6 ) 7 8 var ( 9 // ErrNoChanDBExists is returned when a channel bucket hasn't been 10 // created. 11 ErrNoChanDBExists = fmt.Errorf("channel db has not yet been created") 12 13 // ErrNoHistoricalBucket is returned when the historical channel bucket 14 // not been created yet. 15 ErrNoHistoricalBucket = fmt.Errorf("historical channel bucket has " + 16 "not yet been created") 17 18 // ErrDBReversion is returned when detecting an attempt to revert to a 19 // prior database version. 20 ErrDBReversion = fmt.Errorf("channel db cannot revert to prior version") 21 22 // ErrLinkNodesNotFound is returned when node info bucket hasn't been 23 // created. 24 ErrLinkNodesNotFound = fmt.Errorf("no link nodes exist") 25 26 // ErrNoActiveChannels is returned when there is no active (open) 27 // channels within the database. 28 ErrNoActiveChannels = fmt.Errorf("no active channels exist") 29 30 // ErrNoPastDeltas is returned when the channel delta bucket hasn't been 31 // created. 32 ErrNoPastDeltas = fmt.Errorf("channel has no recorded deltas") 33 34 // ErrInvoiceNotFound is returned when a targeted invoice can't be 35 // found. 36 ErrInvoiceNotFound = fmt.Errorf("unable to locate invoice") 37 38 // ErrNoInvoicesCreated is returned when we don't have invoices in 39 // our database to return. 40 ErrNoInvoicesCreated = fmt.Errorf("there are no existing invoices") 41 42 // ErrDuplicateInvoice is returned when an invoice with the target 43 // payment hash already exists. 44 ErrDuplicateInvoice = fmt.Errorf("invoice with payment hash already exists") 45 46 // ErrDuplicatePayAddr is returned when an invoice with the target 47 // payment addr already exists. 48 ErrDuplicatePayAddr = fmt.Errorf("invoice with payemnt addr already exists") 49 50 // ErrInvRefEquivocation is returned when an InvoiceRef targets 51 // multiple, distinct invoices. 52 ErrInvRefEquivocation = errors.New("inv ref matches multiple invoices") 53 54 // ErrNoPaymentsCreated is returned when bucket of payments hasn't been 55 // created. 56 ErrNoPaymentsCreated = fmt.Errorf("there are no existing payments") 57 58 // ErrNodeNotFound is returned when node bucket exists, but node with 59 // specific identity can't be found. 60 ErrNodeNotFound = fmt.Errorf("link node with target identity not found") 61 62 // ErrChannelNotFound is returned when we attempt to locate a channel 63 // for a specific chain, but it is not found. 64 ErrChannelNotFound = fmt.Errorf("channel not found") 65 66 // ErrMetaNotFound is returned when meta bucket hasn't been 67 // created. 68 ErrMetaNotFound = fmt.Errorf("unable to locate meta information") 69 70 // ErrGraphNotFound is returned when at least one of the components of 71 // graph doesn't exist. 72 ErrGraphNotFound = fmt.Errorf("graph bucket not initialized") 73 74 // ErrGraphNeverPruned is returned when graph was never pruned. 75 ErrGraphNeverPruned = fmt.Errorf("graph never pruned") 76 77 // ErrSourceNodeNotSet is returned if the source node of the graph 78 // hasn't been added The source node is the center node within a 79 // star-graph. 80 ErrSourceNodeNotSet = fmt.Errorf("source node does not exist") 81 82 // ErrGraphNodesNotFound is returned in case none of the nodes has 83 // been added in graph node bucket. 84 ErrGraphNodesNotFound = fmt.Errorf("no graph nodes exist") 85 86 // ErrGraphNoEdgesFound is returned in case of none of the channel/edges 87 // has been added in graph edge bucket. 88 ErrGraphNoEdgesFound = fmt.Errorf("no graph edges exist") 89 90 // ErrGraphNodeNotFound is returned when we're unable to find the target 91 // node. 92 ErrGraphNodeNotFound = fmt.Errorf("unable to find node") 93 94 // ErrEdgeNotFound is returned when an edge for the target chanID 95 // can't be found. 96 ErrEdgeNotFound = fmt.Errorf("edge not found") 97 98 // ErrZombieEdge is an error returned when we attempt to look up an edge 99 // but it is marked as a zombie within the zombie index. 100 ErrZombieEdge = errors.New("edge marked as zombie") 101 102 // ErrEdgeAlreadyExist is returned when edge with specific 103 // channel id can't be added because it already exist. 104 ErrEdgeAlreadyExist = fmt.Errorf("edge already exist") 105 106 // ErrNodeAliasNotFound is returned when alias for node can't be found. 107 ErrNodeAliasNotFound = fmt.Errorf("alias for node not found") 108 109 // ErrUnknownAddressType is returned when a node's addressType is not 110 // an expected value. 111 ErrUnknownAddressType = fmt.Errorf("address type cannot be resolved") 112 113 // ErrNoClosedChannels is returned when a node is queries for all the 114 // channels it has closed, but it hasn't yet closed any channels. 115 ErrNoClosedChannels = fmt.Errorf("no channel have been closed yet") 116 117 // ErrNoForwardingEvents is returned in the case that a query fails due 118 // to the log not having any recorded events. 119 ErrNoForwardingEvents = fmt.Errorf("no recorded forwarding events") 120 121 // ErrEdgePolicyOptionalFieldNotFound is an error returned if a channel 122 // policy field is not found in the db even though its message flags 123 // indicate it should be. 124 ErrEdgePolicyOptionalFieldNotFound = fmt.Errorf("optional field not " + 125 "present") 126 127 // ErrChanAlreadyExists is return when the caller attempts to create a 128 // channel with a channel point that is already present in the 129 // database. 130 ErrChanAlreadyExists = fmt.Errorf("channel already exists") 131 ) 132 133 // ErrTooManyExtraOpaqueBytes creates an error which should be returned if the 134 // caller attempts to write an announcement message which bares too many extra 135 // opaque bytes. We limit this value in order to ensure that we don't waste 136 // disk space due to nodes unnecessarily padding out their announcements with 137 // garbage data. 138 func ErrTooManyExtraOpaqueBytes(numBytes int) error { 139 return fmt.Errorf("max allowed number of opaque bytes is %v, received "+ 140 "%v bytes", MaxAllowedExtraOpaqueBytes, numBytes) 141 }