channeldb/graph: don't create bucket in UpdateChannelEdge
It would return ErrEdgeNotFound when edge not found in bucket anyway.
This commit is contained in:
parent
81fe6e73ed
commit
5d8d99b7bc
@ -652,13 +652,14 @@ func (c *ChannelGraph) UpdateChannelEdge(edge *ChannelEdgeInfo) error {
|
|||||||
binary.BigEndian.PutUint64(chanKey[:], edge.ChannelID)
|
binary.BigEndian.PutUint64(chanKey[:], edge.ChannelID)
|
||||||
|
|
||||||
return c.db.Update(func(tx *bbolt.Tx) error {
|
return c.db.Update(func(tx *bbolt.Tx) error {
|
||||||
edges, err := tx.CreateBucketIfNotExists(edgeBucket)
|
edges := tx.Bucket(edgeBucket)
|
||||||
if err != nil {
|
if edge == nil {
|
||||||
return err
|
return ErrEdgeNotFound
|
||||||
}
|
}
|
||||||
edgeIndex, err := edges.CreateBucketIfNotExists(edgeIndexBucket)
|
|
||||||
if err != nil {
|
edgeIndex := edges.Bucket(edgeIndexBucket)
|
||||||
return err
|
if edgeIndex == nil {
|
||||||
|
return ErrEdgeNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
if edgeInfo := edgeIndex.Get(chanKey[:]); edgeInfo == nil {
|
if edgeInfo := edgeIndex.Get(chanKey[:]); edgeInfo == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user