mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-07 05:49:59 +02:00
graph/db+sqldb: implement HasChannelEdge and ChannelID
And run `TestEdgeInfoUpdates` against our SQL backends.
This commit is contained in:
@ -1167,6 +1167,23 @@ func (q *Queries) GetPublicV1ChannelsBySCID(ctx context.Context, arg GetPublicV1
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getSCIDByOutpoint = `-- name: GetSCIDByOutpoint :one
|
||||
SELECT scid from channels
|
||||
WHERE outpoint = $1 AND version = $2
|
||||
`
|
||||
|
||||
type GetSCIDByOutpointParams struct {
|
||||
Outpoint string
|
||||
Version int16
|
||||
}
|
||||
|
||||
func (q *Queries) GetSCIDByOutpoint(ctx context.Context, arg GetSCIDByOutpointParams) ([]byte, error) {
|
||||
row := q.db.QueryRowContext(ctx, getSCIDByOutpoint, arg.Outpoint, arg.Version)
|
||||
var scid []byte
|
||||
err := row.Scan(&scid)
|
||||
return scid, err
|
||||
}
|
||||
|
||||
const getSourceNodesByVersion = `-- name: GetSourceNodesByVersion :many
|
||||
SELECT sn.node_id, n.pub_key
|
||||
FROM source_nodes sn
|
||||
|
@ -58,6 +58,7 @@ type Querier interface {
|
||||
GetNodeIDByPubKey(ctx context.Context, arg GetNodeIDByPubKeyParams) (int64, error)
|
||||
GetNodesByLastUpdateRange(ctx context.Context, arg GetNodesByLastUpdateRangeParams) ([]Node, error)
|
||||
GetPublicV1ChannelsBySCID(ctx context.Context, arg GetPublicV1ChannelsBySCIDParams) ([]Channel, error)
|
||||
GetSCIDByOutpoint(ctx context.Context, arg GetSCIDByOutpointParams) ([]byte, error)
|
||||
GetSourceNodesByVersion(ctx context.Context, version int16) ([]GetSourceNodesByVersionRow, error)
|
||||
GetZombieChannel(ctx context.Context, arg GetZombieChannelParams) (ZombieChannel, error)
|
||||
HighestSCID(ctx context.Context, version int16) ([]byte, error)
|
||||
|
@ -206,6 +206,10 @@ SELECT
|
||||
FROM channel_extra_types cet
|
||||
WHERE cet.channel_id = $1;
|
||||
|
||||
-- name: GetSCIDByOutpoint :one
|
||||
SELECT scid from channels
|
||||
WHERE outpoint = $1 AND version = $2;
|
||||
|
||||
-- name: GetChannelsByPolicyLastUpdateRange :many
|
||||
SELECT
|
||||
sqlc.embed(c),
|
||||
|
Reference in New Issue
Block a user