From 86d40636cdd3038a44c4edf9bc6d6e6dc1c22c18 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 4 Dec 2018 11:20:38 +0100 Subject: [PATCH] channeldb/graph: don't create bucket in delEdgeUpdateIndexEntry We are deleting what's in the bucket, so if it doesn't exist, just return early with a non-error. --- channeldb/graph.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/channeldb/graph.go b/channeldb/graph.go index 9abf0631..99e0dc24 100644 --- a/channeldb/graph.go +++ b/channeldb/graph.go @@ -1528,11 +1528,10 @@ func delEdgeUpdateIndexEntry(edgesBucket *bbolt.Bucket, chanID uint64, // First, we'll fetch the edge update index bucket which currently // stores an entry for the channel we're about to delete. - updateIndex, err := edgesBucket.CreateBucketIfNotExists( - edgeUpdateIndexBucket, - ) - if err != nil { - return err + updateIndex := edgesBucket.Bucket(edgeUpdateIndexBucket) + if updateIndex == nil { + // No edges in bucket, return early. + return nil } // Now that we have the bucket, we'll attempt to construct a template