channeldb/graph: don't create bucket in UpdateChannelEdge

It would return ErrEdgeNotFound when edge not found in bucket anyway.
This commit is contained in:
Johan T. Halseth 2018-12-04 11:20:38 +01:00
parent 81fe6e73ed
commit 5d8d99b7bc
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -652,13 +652,14 @@ func (c *ChannelGraph) UpdateChannelEdge(edge *ChannelEdgeInfo) error {
binary.BigEndian.PutUint64(chanKey[:], edge.ChannelID)
return c.db.Update(func(tx *bbolt.Tx) error {
edges, err := tx.CreateBucketIfNotExists(edgeBucket)
if err != nil {
return err
edges := tx.Bucket(edgeBucket)
if edge == nil {
return ErrEdgeNotFound
}
edgeIndex, err := edges.CreateBucketIfNotExists(edgeIndexBucket)
if err != nil {
return err
edgeIndex := edges.Bucket(edgeIndexBucket)
if edgeIndex == nil {
return ErrEdgeNotFound
}
if edgeInfo := edgeIndex.Get(chanKey[:]); edgeInfo == nil {