From 9722323161afd25b82eeb30793037f5f6ad4a9cd 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 node bucket in DeleteChannelEdge Instead return ErrGraphNodeNotFound directly. If the node bucket was created it would be empty, and the call delChannelByEdge -> fetchChanEdgePolicies -> fetchChanEdgePolicy -> deserializeChanEdgePolicy -> fetchLightningNode would return this error anyway. --- channeldb/graph.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/channeldb/graph.go b/channeldb/graph.go index ce98cd76..adf15371 100644 --- a/channeldb/graph.go +++ b/channeldb/graph.go @@ -1083,9 +1083,10 @@ func (c *ChannelGraph) DeleteChannelEdge(chanPoint *wire.OutPoint) error { if chanIndex == nil { return ErrEdgeNotFound } - nodes, err := tx.CreateBucketIfNotExists(nodeBucket) - if err != nil { - return err + + nodes := tx.Bucket(nodeBucket) + if nodes == nil { + return ErrGraphNodeNotFound } return delChannelByEdge(