mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-09 15:04:39 +02:00
graph/db+sqldb: implement AddEdgeProof
And run `TestAddEdgeProof` against the SQL backends.
This commit is contained in:
@ -26,6 +26,34 @@ func (q *Queries) AddSourceNode(ctx context.Context, nodeID int64) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const addV1ChannelProof = `-- name: AddV1ChannelProof :execresult
|
||||
UPDATE channels
|
||||
SET node_1_signature = $2,
|
||||
node_2_signature = $3,
|
||||
bitcoin_1_signature = $4,
|
||||
bitcoin_2_signature = $5
|
||||
WHERE scid = $1
|
||||
AND version = 1
|
||||
`
|
||||
|
||||
type AddV1ChannelProofParams struct {
|
||||
Scid []byte
|
||||
Node1Signature []byte
|
||||
Node2Signature []byte
|
||||
Bitcoin1Signature []byte
|
||||
Bitcoin2Signature []byte
|
||||
}
|
||||
|
||||
func (q *Queries) AddV1ChannelProof(ctx context.Context, arg AddV1ChannelProofParams) (sql.Result, error) {
|
||||
return q.db.ExecContext(ctx, addV1ChannelProof,
|
||||
arg.Scid,
|
||||
arg.Node1Signature,
|
||||
arg.Node2Signature,
|
||||
arg.Bitcoin1Signature,
|
||||
arg.Bitcoin2Signature,
|
||||
)
|
||||
}
|
||||
|
||||
const countZombieChannels = `-- name: CountZombieChannels :one
|
||||
SELECT COUNT(*)
|
||||
FROM zombie_channels
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
|
||||
type Querier interface {
|
||||
AddSourceNode(ctx context.Context, nodeID int64) error
|
||||
AddV1ChannelProof(ctx context.Context, arg AddV1ChannelProofParams) (sql.Result, error)
|
||||
ClearKVInvoiceHashIndex(ctx context.Context) error
|
||||
CountZombieChannels(ctx context.Context, version int16) (int64, error)
|
||||
CreateChannel(ctx context.Context, arg CreateChannelParams) (int64, error)
|
||||
|
@ -208,6 +208,15 @@ INSERT INTO channels (
|
||||
)
|
||||
RETURNING id;
|
||||
|
||||
-- name: AddV1ChannelProof :execresult
|
||||
UPDATE channels
|
||||
SET node_1_signature = $2,
|
||||
node_2_signature = $3,
|
||||
bitcoin_1_signature = $4,
|
||||
bitcoin_2_signature = $5
|
||||
WHERE scid = $1
|
||||
AND version = 1;
|
||||
|
||||
-- name: GetChannelsBySCIDRange :many
|
||||
SELECT sqlc.embed(c),
|
||||
n1.pub_key AS node1_pub_key,
|
||||
|
Reference in New Issue
Block a user