channeldb: add ErrEdgeAlreadyExist error

This commit is contained in:
Andrey Samokhvalov authored and Olaoluwa Osuntokun committed 2017-03-29 19:49:05 -07:00
1 parent c3b2854428
commit 7a9a52c7b9
2 files changed
+6 -2

No files matched your search

+5 -1
View File
@@ -69,7 +69,11 @@ var (
// ErrEdgeNotFound is returned when an edge for the target chanID
// can't be found.
ErrEdgeNotFound = fmt.Errorf("edge for chanID not found")
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")
// ErrNodeAliasNotFound is returned when alias for node can't be found.
ErrNodeAliasNotFound = fmt.Errorf("alias for node not found")
+1 -1
View File
@@ -424,7 +424,7 @@ func (c *ChannelGraph) AddChannelEdge(edge *ChannelEdgeInfo) error {
// created. If so, then we can exit early as this method is
// meant to be idempotent.
if edgeInfo := edgeIndex.Get(chanKey[:]); edgeInfo != nil {
return nil
return ErrEdgeAlreadyExist
}
// If the edge hasn't been created yet, then we'll first add it