Skip to content

Commit 32c60c1

Browse files
committed
graphdb: add wrapper to SetSourceNode
This makes sure also our source node is part of the cache.
1 parent 82f77e5 commit 32c60c1

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

graph/db/graph.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,25 @@ func (c *ChannelGraph) AddNode(ctx context.Context,
295295
return nil
296296
}
297297

298+
// SetSourceNode sets the source node in the graph database and also adds it
299+
// to the graph cache.
300+
func (c *ChannelGraph) SetSourceNode(ctx context.Context,
301+
node *models.Node) error {
302+
303+
err := c.V1Store.SetSourceNode(ctx, node)
304+
if err != nil {
305+
return err
306+
}
307+
308+
if c.graphCache != nil {
309+
c.graphCache.AddNodeFeatures(
310+
node.PubKeyBytes, node.Features,
311+
)
312+
}
313+
314+
return nil
315+
}
316+
298317
// DeleteNode starts a new database transaction to remove a vertex/node
299318
// from the database according to the node's public key.
300319
func (c *ChannelGraph) DeleteNode(ctx context.Context,

0 commit comments

Comments
 (0)