channeldb/graph: don't create bucket in UpdateEdgePolicy
instead return ErEdgeNotFound, which would be returned anyway when querying the edgeIndex for the channel.
This commit is contained in:
parent
9722323161
commit
84de318553
@ -1638,13 +1638,14 @@ func delChannelByEdge(edges *bbolt.Bucket, edgeIndex *bbolt.Bucket,
|
|||||||
// the nodes on either side of the channel.
|
// the nodes on either side of the channel.
|
||||||
func (c *ChannelGraph) UpdateEdgePolicy(edge *ChannelEdgePolicy) error {
|
func (c *ChannelGraph) UpdateEdgePolicy(edge *ChannelEdgePolicy) error {
|
||||||
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
|
||||||
}
|
}
|
||||||
nodes, err := tx.CreateBucketIfNotExists(nodeBucket)
|
nodes, err := tx.CreateBucketIfNotExists(nodeBucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user