Merge pull request #9879 from ellemouton/graphSQLFixNodesQuery

sqldb+graph/db: fix UpsertNode query to account for nullable `last_update` field
This commit is contained in:
Oliver Gugger authored and GitHub committed 2025-06-02 21:21:25 +02:00
commit c61095ce0b
3 files changed
+7 -2

No files matched your search

+3
View File
@@ -3359,6 +3359,9 @@ func TestAddChannelEdgeShellNodes(t *testing.T) {
// error.
err = graph.AddChannelEdge(&edgeInfo)
require.ErrorIs(t, err, ErrEdgeAlreadyExist)
// Show that updating the shell node to a full node record works.
require.NoError(t, graph.AddLightningNode(node2))
}
// TestNodePruningUpdateIndexDeletion tests that once a node has been removed
+2 -1
View File
@@ -542,7 +542,8 @@ ON CONFLICT (pub_key, version)
last_update = EXCLUDED.last_update,
color = EXCLUDED.color,
signature = EXCLUDED.signature
WHERE EXCLUDED.last_update > nodes.last_update
WHERE nodes.last_update IS NULL
OR EXCLUDED.last_update > nodes.last_update
RETURNING id
`
+2 -1
View File
@@ -17,7 +17,8 @@ ON CONFLICT (pub_key, version)
last_update = EXCLUDED.last_update,
color = EXCLUDED.color,
signature = EXCLUDED.signature
WHERE EXCLUDED.last_update > nodes.last_update
WHERE nodes.last_update IS NULL
OR EXCLUDED.last_update > nodes.last_update
RETURNING id;
-- name: GetNodeByPubKey :one