loop/loopdb/sqlc/queries/static_addresses.sql
Slyghtning 991830336f
loopdb: persist deposit address ownership
Associate every deposit with the static address parameters that created
it. This lets restored deposits recover the correct script and signing
keys instead of assuming the legacy root address.
2026-08-10 14:18:04 +02:00

37 lines
715 B
SQL

-- name: AllStaticAddresses :many
SELECT * FROM static_addresses
ORDER BY id ASC;
-- name: GetStaticAddress :one
SELECT * FROM static_addresses
WHERE pkscript=$1;
-- name: GetStaticAddressID :one
SELECT id FROM static_addresses
WHERE pkscript=$1;
-- name: CreateStaticAddress :exec
INSERT INTO static_addresses (
client_pubkey,
server_pubkey,
expiry,
client_key_family,
client_key_index,
pkscript,
protocol_version,
initiation_height
) VALUES (
$1,
$2,
$3,
$4,
$5,
$6,
$7,
$8
);
-- name: GetLegacyAddress :one
SELECT * FROM static_addresses
ORDER BY id ASC
LIMIT 1;