Skip to content

Commit eb32b39

Browse files
committed
graph/db: demonstrate SQL upsert node bug
1 parent e9692f8 commit eb32b39

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

graph/db/graph_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3359,6 +3359,20 @@ func TestAddChannelEdgeShellNodes(t *testing.T) {
33593359
// error.
33603360
err = graph.AddChannelEdge(&edgeInfo)
33613361
require.ErrorIs(t, err, ErrEdgeAlreadyExist)
3362+
3363+
// Show that updating the shell node to a full node record works.
3364+
err = graph.AddLightningNode(node2)
3365+
_, ok := graph.V1Store.(*KVStore)
3366+
if ok {
3367+
require.NoError(t, err)
3368+
} else {
3369+
// Currently the SQL UpsertNode query prevents us from updating
3370+
// the node record if the current record's last_update field
3371+
// is null (which is the case for node2). This is a bug that
3372+
// will be fixed in the following commit.
3373+
require.ErrorContains(t, graph.AddLightningNode(node2),
3374+
"sql: no rows in result set")
3375+
}
33623376
}
33633377

33643378
// TestNodePruningUpdateIndexDeletion tests that once a node has been removed

0 commit comments

Comments
 (0)