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

+3 -3
View File
@@ -138,7 +138,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
dbNode, err := graph.FetchNode(ctx, testPub)
require.NoError(t, err, "unable to locate node")
_, exists, err := graph.HasNode(ctx, dbNode.PubKeyBytes)
exists, err := graph.HasNode(ctx, dbNode.PubKeyBytes)
require.NoError(t, err)
require.True(t, exists)
@@ -309,7 +309,7 @@ func TestPartialNode(t *testing.T) {
dbNode2, err := graph.FetchNode(ctx, pubKey2)
require.NoError(t, err)
_, exists, err := graph.HasNode(ctx, dbNode1.PubKeyBytes)
exists, err := graph.HasNode(ctx, dbNode1.PubKeyBytes)
require.NoError(t, err)
require.True(t, exists)
@@ -318,7 +318,7 @@ func TestPartialNode(t *testing.T) {
expectedNode1 := models.NewV1ShellNode(pubKey1)
compareNodes(t, expectedNode1, dbNode1)
_, exists, err = graph.HasNode(ctx, dbNode2.PubKeyBytes)
exists, err = graph.HasNode(ctx, dbNode2.PubKeyBytes)
require.NoError(t, err)
require.True(t, exists)