Skip to content

Commit 2a5a4a0

Browse files
committed
sqldb/sqlc: add IsPublicV2Node query
1 parent bb86c68 commit 2a5a4a0

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

sqldb/sqlc/graph.sql.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sqldb/sqlc/querier.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sqldb/sqlc/queries/graph.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ SELECT EXISTS (
7373
AND n.pub_key = $1
7474
);
7575

76+
-- name: IsPublicV2Node :one
77+
SELECT EXISTS (
78+
SELECT 1
79+
FROM graph_channels c
80+
JOIN graph_nodes n ON n.id = c.node_id_1 OR n.id = c.node_id_2
81+
-- NOTE: we hard-code the version here since the clauses
82+
-- here that determine if a node is public is specific
83+
-- to the V2 gossip protocol.
84+
WHERE c.version = 2
85+
AND c.signature IS NOT NULL
86+
AND n.pub_key = $1
87+
);
88+
7689
-- name: DeleteUnconnectedNodes :many
7790
DELETE FROM graph_nodes
7891
WHERE

0 commit comments

Comments
 (0)