graph/db+sqldb: pass set of outpoints to SQL

This commit adds a new GetChannelsByOutpoints query which takes a slice
of outpoint strings. This lets us then update PruneGraph to use
paginated calls to GetChannelsByOutpoints instead of making one DB call
per outpoint.
This commit is contained in:
Elle Mouton committed 2025-07-22 17:16:49 +02:00
1 parent 2fa30e8735
commit f72c48b283
4 files changed
+44 -69

No files matched your search

-10
View File
@@ -242,16 +242,6 @@ FROM graph_channels c
WHERE c.outpoint IN
(sqlc.slice('outpoints')/*SLICE:outpoints*/);
-- name: GetChannelByOutpoint :one
SELECT
sqlc.embed(c),
n1.pub_key AS node1_pubkey,
n2.pub_key AS node2_pubkey
FROM graph_channels c
JOIN graph_nodes n1 ON c.node_id_1 = n1.id
JOIN graph_nodes n2 ON c.node_id_2 = n2.id
WHERE c.outpoint = $1;
-- name: GetChannelAndNodesBySCID :one
SELECT
c.*,