sqldb+graphdb: SQL methods for Node CRUD

In this commit, we add the various sqlc queries that we need in order
to implement the following V1Store methods:

- AddLightningNode
- FetchLightningNode
- HasLightningNode
- AddrsForNode
- DeleteLightningNode
- FetchNodeFeatures

These are implemented by SQLStore which then lets us use the SQLStore
backend for the following unit tests:

- TestNodeInsertionAndDeletion
- TestLightningNodePersistence
This commit is contained in:
Elle Mouton committed 2025-05-27 18:36:59 +02:00
1 parent ffbe4f6ffc
commit d1f7cce68b
6 files changed
+1315 -3

No files matched your search

+5 -3
View File
@@ -101,15 +101,17 @@ func createTestVertex(t testing.TB) *models.LightningNode {
func TestNodeInsertionAndDeletion(t *testing.T) {
t.Parallel()
graph := MakeTestGraph(t)
graph := MakeTestGraphNew(t)
// We'd like to test basic insertion/deletion for vertexes from the
// graph, so we'll create a test vertex to start with.
timeStamp := int64(1232342)
nodeWithAddrs := func(addrs []net.Addr) *models.LightningNode {
timeStamp++
return &models.LightningNode{
HaveNodeAnnouncement: true,
AuthSigBytes: testSig.Serialize(),
LastUpdate: time.Unix(1232342, 0),
LastUpdate: time.Unix(timeStamp, 0),
Color: color.RGBA{1, 2, 3, 0},
Alias: "kek",
Features: testFeatures,
@@ -4315,7 +4317,7 @@ func TestLightningNodePersistence(t *testing.T) {
t.Parallel()
// Create a new test graph instance.
graph := MakeTestGraph(t)
graph := MakeTestGraphNew(t)
nodeAnnBytes, err := hex.DecodeString(testNodeAnn)
require.NoError(t, err)