graph/db: split HasNode into two methods

HasNode currently is very v1 specific since it returns a time.Time
timestamp which is specific to V1 node announcements. However, it is
mostly only used for the "exists" return value. So here we split it up
into HasNode which just checks existence and HasV1Node which retains the
same behavaiour as before.
This commit is contained in:
Elle Mouton committed 2026-02-13 07:21:20 +02:00
1 parent 5a3c013e91
commit 97143a74ab
8 files changed
+100 -25

No files matched your search

+4 -4
View File
@@ -2717,11 +2717,11 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
copy(pub2[:], priv2.PubKey().SerializeCompressed())
// The two nodes we are about to add should not exist yet.
_, exists1, err := ctx.graph.HasNode(ctxb, pub1)
exists1, err := ctx.graph.HasNode(ctxb, pub1)
require.NoError(t, err, "unable to query graph")
require.False(t, exists1)
_, exists2, err := ctx.graph.HasNode(ctxb, pub2)
exists2, err := ctx.graph.HasNode(ctxb, pub2)
require.NoError(t, err, "unable to query graph")
require.False(t, exists2)
@@ -2778,11 +2778,11 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
// After adding the edge between the two previously unknown nodes, they
// should have been added to the graph.
_, exists1, err = ctx.graph.HasNode(ctxb, pub1)
exists1, err = ctx.graph.HasNode(ctxb, pub1)
require.NoError(t, err, "unable to query graph")
require.True(t, exists1)
_, exists2, err = ctx.graph.HasNode(ctxb, pub2)
exists2, err = ctx.graph.HasNode(ctxb, pub2)
require.NoError(t, err, "unable to query graph")
require.True(t, exists2)