error.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. package channeldb
  2. import (
  3. "errors"
  4. "fmt"
  5. )
  6. var (
  7. // ErrNoChanDBExists is returned when a channel bucket hasn't been
  8. // created.
  9. ErrNoChanDBExists = fmt.Errorf("channel db has not yet been created")
  10. // ErrNoHistoricalBucket is returned when the historical channel bucket
  11. // not been created yet.
  12. ErrNoHistoricalBucket = fmt.Errorf("historical channel bucket has " +
  13. "not yet been created")
  14. // ErrDBReversion is returned when detecting an attempt to revert to a
  15. // prior database version.
  16. ErrDBReversion = fmt.Errorf("channel db cannot revert to prior version")
  17. // ErrLinkNodesNotFound is returned when node info bucket hasn't been
  18. // created.
  19. ErrLinkNodesNotFound = fmt.Errorf("no link nodes exist")
  20. // ErrNoActiveChannels is returned when there is no active (open)
  21. // channels within the database.
  22. ErrNoActiveChannels = fmt.Errorf("no active channels exist")
  23. // ErrNoPastDeltas is returned when the channel delta bucket hasn't been
  24. // created.
  25. ErrNoPastDeltas = fmt.Errorf("channel has no recorded deltas")
  26. // ErrNodeNotFound is returned when node bucket exists, but node with
  27. // specific identity can't be found.
  28. ErrNodeNotFound = fmt.Errorf("link node with target identity not found")
  29. // ErrChannelNotFound is returned when we attempt to locate a channel
  30. // for a specific chain, but it is not found.
  31. ErrChannelNotFound = fmt.Errorf("channel not found")
  32. // ErrMetaNotFound is returned when meta bucket hasn't been
  33. // created.
  34. ErrMetaNotFound = fmt.Errorf("unable to locate meta information")
  35. // ErrGraphNotFound is returned when at least one of the components of
  36. // graph doesn't exist.
  37. ErrGraphNotFound = fmt.Errorf("graph bucket not initialized")
  38. // ErrGraphNeverPruned is returned when graph was never pruned.
  39. ErrGraphNeverPruned = fmt.Errorf("graph never pruned")
  40. // ErrSourceNodeNotSet is returned if the source node of the graph
  41. // hasn't been added The source node is the center node within a
  42. // star-graph.
  43. ErrSourceNodeNotSet = fmt.Errorf("source node does not exist")
  44. // ErrGraphNodesNotFound is returned in case none of the nodes has
  45. // been added in graph node bucket.
  46. ErrGraphNodesNotFound = fmt.Errorf("no graph nodes exist")
  47. // ErrGraphNoEdgesFound is returned in case of none of the channel/edges
  48. // has been added in graph edge bucket.
  49. ErrGraphNoEdgesFound = fmt.Errorf("no graph edges exist")
  50. // ErrGraphNodeNotFound is returned when we're unable to find the target
  51. // node.
  52. ErrGraphNodeNotFound = fmt.Errorf("unable to find node")
  53. // ErrEdgeNotFound is returned when an edge for the target chanID
  54. // can't be found.
  55. ErrEdgeNotFound = fmt.Errorf("edge not found")
  56. // ErrZombieEdge is an error returned when we attempt to look up an edge
  57. // but it is marked as a zombie within the zombie index.
  58. ErrZombieEdge = errors.New("edge marked as zombie")
  59. // ErrZombieEdgeNotFound is an error returned when we attempt to find an
  60. // edge in the zombie index which is not there.
  61. ErrZombieEdgeNotFound = errors.New("edge not found in zombie index")
  62. // ErrEdgeAlreadyExist is returned when edge with specific
  63. // channel id can't be added because it already exist.
  64. ErrEdgeAlreadyExist = fmt.Errorf("edge already exist")
  65. // ErrNodeAliasNotFound is returned when alias for node can't be found.
  66. ErrNodeAliasNotFound = fmt.Errorf("alias for node not found")
  67. // ErrUnknownAddressType is returned when a node's addressType is not
  68. // an expected value.
  69. ErrUnknownAddressType = fmt.Errorf("address type cannot be resolved")
  70. // ErrNoClosedChannels is returned when a node is queries for all the
  71. // channels it has closed, but it hasn't yet closed any channels.
  72. ErrNoClosedChannels = fmt.Errorf("no channel have been closed yet")
  73. // ErrNoForwardingEvents is returned in the case that a query fails due
  74. // to the log not having any recorded events.
  75. ErrNoForwardingEvents = fmt.Errorf("no recorded forwarding events")
  76. // ErrEdgePolicyOptionalFieldNotFound is an error returned if a channel
  77. // policy field is not found in the db even though its message flags
  78. // indicate it should be.
  79. ErrEdgePolicyOptionalFieldNotFound = fmt.Errorf("optional field not " +
  80. "present")
  81. // ErrChanAlreadyExists is return when the caller attempts to create a
  82. // channel with a channel point that is already present in the
  83. // database.
  84. ErrChanAlreadyExists = fmt.Errorf("channel already exists")
  85. )
  86. // ErrTooManyExtraOpaqueBytes creates an error which should be returned if the
  87. // caller attempts to write an announcement message which bares too many extra
  88. // opaque bytes. We limit this value in order to ensure that we don't waste
  89. // disk space due to nodes unnecessarily padding out their announcements with
  90. // garbage data.
  91. func ErrTooManyExtraOpaqueBytes(numBytes int) error {
  92. return fmt.Errorf("max allowed number of opaque bytes is %v, received "+
  93. "%v bytes", MaxAllowedExtraOpaqueBytes, numBytes)
  94. }