sqldb/sqlc: add AddV2ChannelProof query

Add SQL query to update the signature column for v2 channel auth proofs.
Unlike v1 which requires four separate signatures, v2 channels use a
single aggregated signature.
This commit is contained in:
Elle Mouton committed 2026-02-13 07:21:23 +02:00
1 parent a73189ccec
commit 315f5ed741
3 files changed
+23

No files matched your search

+16
View File
@@ -55,6 +55,22 @@ func (q *Queries) AddV1ChannelProof(ctx context.Context, arg AddV1ChannelProofPa
)
}
const addV2ChannelProof = `-- name: AddV2ChannelProof :execresult
UPDATE graph_channels
SET signature = $2
WHERE scid = $1
AND version = 2
`
type AddV2ChannelProofParams struct {
Scid []byte
Signature []byte
}
func (q *Queries) AddV2ChannelProof(ctx context.Context, arg AddV2ChannelProofParams) (sql.Result, error) {
return q.db.ExecContext(ctx, addV2ChannelProof, arg.Scid, arg.Signature)
}
const countZombieChannels = `-- name: CountZombieChannels :one
SELECT COUNT(*)
FROM graph_zombie_channels
+1
View File
@@ -13,6 +13,7 @@ import (
type Querier interface {
AddSourceNode(ctx context.Context, nodeID int64) error
AddV1ChannelProof(ctx context.Context, arg AddV1ChannelProofParams) (sql.Result, error)
AddV2ChannelProof(ctx context.Context, arg AddV2ChannelProofParams) (sql.Result, error)
ClearKVInvoiceHashIndex(ctx context.Context) error
CountZombieChannels(ctx context.Context, version int16) (int64, error)
CreateChannel(ctx context.Context, arg CreateChannelParams) (int64, error)
+6
View File
@@ -312,6 +312,12 @@ SET node_1_signature = $2,
WHERE scid = $1
AND version = 1;
-- name: AddV2ChannelProof :execresult
UPDATE graph_channels
SET signature = $2
WHERE scid = $1
AND version = 2;
-- name: GetChannelsBySCIDRange :many
SELECT sqlc.embed(c),
n1.pub_key AS node1_pub_key,