From 714e528a3aeb9612772d32af45fbbe9210f6bf35 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Mon, 30 Jun 2025 18:06:41 +0200 Subject: [PATCH] graph/db: fix address fetching error --- graph/db/graph_test.go | 12 +----------- graph/db/sql_store.go | 6 ++++++ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/graph/db/graph_test.go b/graph/db/graph_test.go index c76d4006b..98148d079 100644 --- a/graph/db/graph_test.go +++ b/graph/db/graph_test.go @@ -190,17 +190,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) { // Fetch the node and assert the empty addresses. dbNode, err = graph.FetchLightningNode(ctx, testPub) require.NoError(t, err) - - // Temporarily have a special case for SQLStore, as currently, it does - // not correctly handle empty addresses. We assert this incorrect - // behaviour here in order to demonstrate the bug. This will be fixed in - // an upcoming commit. - if _, ok := graph.V1Store.(*SQLStore); ok { - require.Empty(t, dbNode.Addresses) - require.NotEqual(t, node.Addresses, dbNode.Addresses) - } else { - compareNodes(t, node, dbNode) - } + compareNodes(t, node, dbNode) known, addrs, err = graph.AddrsForNode(ctx, pub) require.NoError(t, err) diff --git a/graph/db/sql_store.go b/graph/db/sql_store.go index 9b8682c76..10edcea23 100644 --- a/graph/db/sql_store.go +++ b/graph/db/sql_store.go @@ -3619,6 +3619,12 @@ func getNodeAddresses(ctx context.Context, db SQLQueries, nodePub []byte) (bool, } } + // If we have no addresses, then we'll return nil instead of an + // empty slice. + if len(addresses) == 0 { + addresses = nil + } + return true, addresses, nil }