mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-07 22:10:27 +02:00
graph/db+sqldb: impl PutClosedScid and IsClosedScid
This commit is contained in:
@ -1555,6 +1555,22 @@ func (q *Queries) InsertChannelFeature(ctx context.Context, arg InsertChannelFea
|
||||
return err
|
||||
}
|
||||
|
||||
const insertClosedChannel = `-- name: InsertClosedChannel :exec
|
||||
/* ─────────────────────────────────────────────
|
||||
closed_scid table queries
|
||||
────────────────────────────────────────────-
|
||||
*/
|
||||
|
||||
INSERT INTO closed_scids (scid)
|
||||
VALUES ($1)
|
||||
ON CONFLICT (scid) DO NOTHING
|
||||
`
|
||||
|
||||
func (q *Queries) InsertClosedChannel(ctx context.Context, scid []byte) error {
|
||||
_, err := q.db.ExecContext(ctx, insertClosedChannel, scid)
|
||||
return err
|
||||
}
|
||||
|
||||
const insertNodeAddress = `-- name: InsertNodeAddress :exec
|
||||
/* ─────────────────────────────────────────────
|
||||
node_addresses table queries
|
||||
@ -1611,6 +1627,21 @@ func (q *Queries) InsertNodeFeature(ctx context.Context, arg InsertNodeFeaturePa
|
||||
return err
|
||||
}
|
||||
|
||||
const isClosedChannel = `-- name: IsClosedChannel :one
|
||||
SELECT EXISTS (
|
||||
SELECT 1
|
||||
FROM closed_scids
|
||||
WHERE scid = $1
|
||||
)
|
||||
`
|
||||
|
||||
func (q *Queries) IsClosedChannel(ctx context.Context, scid []byte) (bool, error) {
|
||||
row := q.db.QueryRowContext(ctx, isClosedChannel, scid)
|
||||
var exists bool
|
||||
err := row.Scan(&exists)
|
||||
return exists, err
|
||||
}
|
||||
|
||||
const isPublicV1Node = `-- name: IsPublicV1Node :one
|
||||
SELECT EXISTS (
|
||||
SELECT 1
|
||||
|
Reference in New Issue
Block a user