mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-08 22:41:00 +02:00
sqldb+graph/db: source nodes table, queries and CRUD
In this commit, we add the `source_nodes` table. It points to entries in the `nodes` table. This table will store one entry per protocol version that we are announcing a node_announcement on. With this commit, we can run the TestSourceNode unit test against our SQL backends.
This commit is contained in:
@ -116,3 +116,19 @@ WHERE node_id = $1;
|
||||
DELETE FROM node_extra_types
|
||||
WHERE node_id = $1
|
||||
AND type = $2;
|
||||
|
||||
/* ─────────────────────────────────────────────
|
||||
source_nodes table queries
|
||||
─────────────────────────────────────────────
|
||||
*/
|
||||
|
||||
-- name: AddSourceNode :exec
|
||||
INSERT INTO source_nodes (node_id)
|
||||
VALUES ($1)
|
||||
ON CONFLICT (node_id) DO NOTHING;
|
||||
|
||||
-- name: GetSourceNodesByVersion :many
|
||||
SELECT sn.node_id, n.pub_key
|
||||
FROM source_nodes sn
|
||||
JOIN nodes n ON sn.node_id = n.id
|
||||
WHERE n.version = $1;
|
||||
|
Reference in New Issue
Block a user