sqldb+graph/db: fix UpsertNode bug

Account for the last_update field being null.
This commit is contained in:
Elle Mouton committed 2025-06-02 17:29:03 +02:00
1 parent eb32b39380
commit 547b836180
3 files changed
+5 -14

No files matched your search

+1 -12
View File
@@ -3361,18 +3361,7 @@ func TestAddChannelEdgeShellNodes(t *testing.T) {
require.ErrorIs(t, err, ErrEdgeAlreadyExist)
// Show that updating the shell node to a full node record works.
err = graph.AddLightningNode(node2)
_, ok := graph.V1Store.(*KVStore)
if ok {
require.NoError(t, err)
} else {
// Currently the SQL UpsertNode query prevents us from updating
// the node record if the current record's last_update field
// is null (which is the case for node2). This is a bug that
// will be fixed in the following commit.
require.ErrorContains(t, graph.AddLightningNode(node2),
"sql: no rows in result set")
}
require.NoError(t, graph.AddLightningNode(node2))
}
// TestNodePruningUpdateIndexDeletion tests that once a node has been removed