Skip to content

Commit 330f697

Browse files
committed
graph: rename HasLightningNode
to HasNode
1 parent 7a1b548 commit 330f697

File tree

8 files changed

+16
-18
lines changed

8 files changed

+16
-18
lines changed

graph/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ func (b *Builder) assertNodeAnnFreshness(ctx context.Context, node route.Vertex,
873873
// node announcements, we will ignore such nodes. If we do know about
874874
// this node, check that this update brings info newer than what we
875875
// already have.
876-
lastUpdate, exists, err := b.cfg.Graph.HasLightningNode(ctx, node)
876+
lastUpdate, exists, err := b.cfg.Graph.HasNode(ctx, node)
877877
if err != nil {
878878
return fmt.Errorf("unable to query for the "+
879879
"existence of node: %w", err)

graph/db/graph_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
130130
dbNode, err := graph.FetchNode(ctx, testPub)
131131
require.NoError(t, err, "unable to locate node")
132132

133-
_, exists, err := graph.HasLightningNode(ctx, dbNode.PubKeyBytes)
133+
_, exists, err := graph.HasNode(ctx, dbNode.PubKeyBytes)
134134
require.NoError(t, err)
135135
require.True(t, exists)
136136

@@ -301,7 +301,7 @@ func TestPartialNode(t *testing.T) {
301301
dbNode2, err := graph.FetchNode(ctx, pubKey2)
302302
require.NoError(t, err)
303303

304-
_, exists, err := graph.HasLightningNode(ctx, dbNode1.PubKeyBytes)
304+
_, exists, err := graph.HasNode(ctx, dbNode1.PubKeyBytes)
305305
require.NoError(t, err)
306306
require.True(t, exists)
307307

@@ -315,7 +315,7 @@ func TestPartialNode(t *testing.T) {
315315
}
316316
compareNodes(t, expectedNode1, dbNode1)
317317

318-
_, exists, err = graph.HasLightningNode(ctx, dbNode2.PubKeyBytes)
318+
_, exists, err = graph.HasNode(ctx, dbNode2.PubKeyBytes)
319319
require.NoError(t, err)
320320
require.True(t, exists)
321321

graph/db/interfaces.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,12 @@ type V1Store interface { //nolint:interfacebloat
118118
FetchNode(ctx context.Context, nodePub route.Vertex) (*models.Node,
119119
error)
120120

121-
// HasLightningNode determines if the graph has a vertex identified by
121+
// HasNode determines if the graph has a vertex identified by
122122
// the target node identity public key. If the node exists in the
123123
// database, a timestamp of when the data for the node was lasted
124124
// updated is returned along with a true boolean. Otherwise, an empty
125125
// time.Time is returned with a false boolean.
126-
HasLightningNode(ctx context.Context, nodePub [33]byte) (time.Time,
127-
bool, error)
126+
HasNode(ctx context.Context, nodePub [33]byte) (time.Time, bool, error)
128127

129128
// IsPublicNode is a helper method that determines whether the node with
130129
// the given public key is seen as a public node in the graph from the

graph/db/kv_store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3124,7 +3124,7 @@ func (c *KVStore) fetchLightningNode(tx kvdb.RTx,
31243124
// timestamp of when the data for the node was lasted updated is returned along
31253125
// with a true boolean. Otherwise, an empty time.Time is returned with a false
31263126
// boolean.
3127-
func (c *KVStore) HasLightningNode(_ context.Context,
3127+
func (c *KVStore) HasNode(_ context.Context,
31283128
nodePub [33]byte) (time.Time, bool, error) {
31293129

31303130
var (

graph/db/sql_store.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,14 @@ func (s *SQLStore) FetchNode(ctx context.Context,
283283
return node, nil
284284
}
285285

286-
// HasLightningNode determines if the graph has a vertex identified by the
286+
// HasNode determines if the graph has a vertex identified by the
287287
// target node identity public key. If the node exists in the database, a
288288
// timestamp of when the data for the node was lasted updated is returned along
289289
// with a true boolean. Otherwise, an empty time.Time is returned with a false
290290
// boolean.
291291
//
292292
// NOTE: part of the V1Store interface.
293-
func (s *SQLStore) HasLightningNode(ctx context.Context,
293+
func (s *SQLStore) HasNode(ctx context.Context,
294294
pubKey [33]byte) (time.Time, bool, error) {
295295

296296
var (

graph/interfaces.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,12 @@ type DB interface {
234234
UpdateEdgePolicy(ctx context.Context, edge *models.ChannelEdgePolicy,
235235
op ...batch.SchedulerOption) error
236236

237-
// HasLightningNode determines if the graph has a vertex identified by
237+
// HasNode determines if the graph has a vertex identified by
238238
// the target node identity public key. If the node exists in the
239239
// database, a timestamp of when the data for the node was lasted
240240
// updated is returned along with a true boolean. Otherwise, an empty
241241
// time.Time is returned with a false boolean.
242-
HasLightningNode(ctx context.Context, nodePub [33]byte) (time.Time,
243-
bool, error)
242+
HasNode(ctx context.Context, nodePub [33]byte) (time.Time, bool, error)
244243

245244
// FetchNode attempts to look up a target node by its identity
246245
// public key. If the node isn't found in the database, then

routing/router_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2718,11 +2718,11 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
27182718
copy(pub2[:], priv2.PubKey().SerializeCompressed())
27192719

27202720
// The two nodes we are about to add should not exist yet.
2721-
_, exists1, err := ctx.graph.HasLightningNode(ctxb, pub1)
2721+
_, exists1, err := ctx.graph.HasNode(ctxb, pub1)
27222722
require.NoError(t, err, "unable to query graph")
27232723
require.False(t, exists1)
27242724

2725-
_, exists2, err := ctx.graph.HasLightningNode(ctxb, pub2)
2725+
_, exists2, err := ctx.graph.HasNode(ctxb, pub2)
27262726
require.NoError(t, err, "unable to query graph")
27272727
require.False(t, exists2)
27282728

@@ -2779,11 +2779,11 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
27792779

27802780
// After adding the edge between the two previously unknown nodes, they
27812781
// should have been added to the graph.
2782-
_, exists1, err = ctx.graph.HasLightningNode(ctxb, pub1)
2782+
_, exists1, err = ctx.graph.HasNode(ctxb, pub1)
27832783
require.NoError(t, err, "unable to query graph")
27842784
require.True(t, exists1)
27852785

2786-
_, exists2, err = ctx.graph.HasLightningNode(ctxb, pub2)
2786+
_, exists2, err = ctx.graph.HasNode(ctxb, pub2)
27872787
require.NoError(t, err, "unable to query graph")
27882788
require.True(t, exists2)
27892789

rpcserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ func (r *rpcServer) VerifyMessage(ctx context.Context,
17831783
//
17841784
// TODO(phlip9): Require valid nodes to have capital in active channels.
17851785
graph := r.server.graphDB
1786-
_, active, err := graph.HasLightningNode(ctx, pub)
1786+
_, active, err := graph.HasNode(ctx, pub)
17871787
if err != nil {
17881788
return nil, fmt.Errorf("failed to query graph: %w", err)
17891789
}

0 commit comments

Comments
 (0)