sqldb/sqlc: update graph CreateChannel query for v2

Add three new optional fields to the CreateChannel SQL query to
support v2 channel announcements:
- signature: single schnorr signature (replaces four ECDSA sigs)
- funding_pk_script: the funding output script
- merkle_root_hash: for taproot channels

These fields are NULL for v1 channels and populated for v2 channels.
This commit is contained in:
Elle Mouton committed 2026-02-13 07:21:21 +02:00
1 parent b13b0bb922
commit ec46480a86
2 files changed
+10 -4

No files matched your search

+8 -2
View File
@@ -78,9 +78,9 @@ INSERT INTO graph_channels (
version, scid, node_id_1, node_id_2,
outpoint, capacity, bitcoin_key_1, bitcoin_key_2,
node_1_signature, node_2_signature, bitcoin_1_signature,
bitcoin_2_signature
bitcoin_2_signature, signature, funding_pk_script, merkle_root_hash
) VALUES (
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15
)
RETURNING id
`
@@ -98,6 +98,9 @@ type CreateChannelParams struct {
Node2Signature []byte
Bitcoin1Signature []byte
Bitcoin2Signature []byte
Signature []byte
FundingPkScript []byte
MerkleRootHash []byte
}
func (q *Queries) CreateChannel(ctx context.Context, arg CreateChannelParams) (int64, error) {
@@ -114,6 +117,9 @@ func (q *Queries) CreateChannel(ctx context.Context, arg CreateChannelParams) (i
arg.Node2Signature,
arg.Bitcoin1Signature,
arg.Bitcoin2Signature,
arg.Signature,
arg.FundingPkScript,
arg.MerkleRootHash,
)
var id int64
err := row.Scan(&id)
+2 -2
View File
@@ -297,9 +297,9 @@ INSERT INTO graph_channels (
version, scid, node_id_1, node_id_2,
outpoint, capacity, bitcoin_key_1, bitcoin_key_2,
node_1_signature, node_2_signature, bitcoin_1_signature,
bitcoin_2_signature
bitcoin_2_signature, signature, funding_pk_script, merkle_root_hash
) VALUES (
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15
)
RETURNING id;