mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 11:13:21 +02:00
graph/db+sqldb: implement DeleteChannelEdges
This lets us run TestGraphZombieIndex against the SQL backends.
This commit is contained in:
@@ -373,6 +373,9 @@ WHERE c.version = $1 AND c.id > $2
|
||||
ORDER BY c.id
|
||||
LIMIT $3;
|
||||
|
||||
-- name: DeleteChannel :exec
|
||||
DELETE FROM channels WHERE id = $1;
|
||||
|
||||
/* ─────────────────────────────────────────────
|
||||
channel_features table queries
|
||||
─────────────────────────────────────────────
|
||||
@@ -434,6 +437,52 @@ WHERE channel_id = $1
|
||||
AND node_id = $2
|
||||
AND version = $3;
|
||||
|
||||
-- name: GetChannelBySCIDWithPolicies :one
|
||||
SELECT
|
||||
sqlc.embed(c),
|
||||
sqlc.embed(n1),
|
||||
sqlc.embed(n2),
|
||||
|
||||
-- Policy 1
|
||||
cp1.id AS policy1_id,
|
||||
cp1.node_id AS policy1_node_id,
|
||||
cp1.version AS policy1_version,
|
||||
cp1.timelock AS policy1_timelock,
|
||||
cp1.fee_ppm AS policy1_fee_ppm,
|
||||
cp1.base_fee_msat AS policy1_base_fee_msat,
|
||||
cp1.min_htlc_msat AS policy1_min_htlc_msat,
|
||||
cp1.max_htlc_msat AS policy1_max_htlc_msat,
|
||||
cp1.last_update AS policy1_last_update,
|
||||
cp1.disabled AS policy1_disabled,
|
||||
cp1.inbound_base_fee_msat AS policy1_inbound_base_fee_msat,
|
||||
cp1.inbound_fee_rate_milli_msat AS policy1_inbound_fee_rate_milli_msat,
|
||||
cp1.signature AS policy1_signature,
|
||||
|
||||
-- Policy 2
|
||||
cp2.id AS policy2_id,
|
||||
cp2.node_id AS policy2_node_id,
|
||||
cp2.version AS policy2_version,
|
||||
cp2.timelock AS policy2_timelock,
|
||||
cp2.fee_ppm AS policy2_fee_ppm,
|
||||
cp2.base_fee_msat AS policy2_base_fee_msat,
|
||||
cp2.min_htlc_msat AS policy2_min_htlc_msat,
|
||||
cp2.max_htlc_msat AS policy2_max_htlc_msat,
|
||||
cp2.last_update AS policy2_last_update,
|
||||
cp2.disabled AS policy2_disabled,
|
||||
cp2.inbound_base_fee_msat AS policy2_inbound_base_fee_msat,
|
||||
cp2.inbound_fee_rate_milli_msat AS policy2_inbound_fee_rate_milli_msat,
|
||||
cp2.signature AS policy2_signature
|
||||
|
||||
FROM channels c
|
||||
JOIN nodes n1 ON c.node_id_1 = n1.id
|
||||
JOIN nodes n2 ON c.node_id_2 = n2.id
|
||||
LEFT JOIN channel_policies cp1
|
||||
ON cp1.channel_id = c.id AND cp1.node_id = c.node_id_1 AND cp1.version = c.version
|
||||
LEFT JOIN channel_policies cp2
|
||||
ON cp2.channel_id = c.id AND cp2.node_id = c.node_id_2 AND cp2.version = c.version
|
||||
WHERE c.scid = @scid
|
||||
AND c.version = @version;
|
||||
|
||||
/* ─────────────────────────────────────────────
|
||||
channel_policy_extra_types table queries
|
||||
─────────────────────────────────────────────
|
||||
|
Reference in New Issue
Block a user