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.
This commit is contained in:
Slyghtning 2026-07-10 11:58:03 +02:00
parent 374ab5dd4d
commit 991830336f
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF
15 changed files with 498 additions and 43 deletions

View file

@ -45,7 +45,7 @@ func (q *Queries) DepositIDsForSwapHash(ctx context.Context, swapHash []byte) ([
const depositsForSwapHash = `-- name: DepositsForSwapHash :many
SELECT
d.id, d.deposit_id, d.tx_hash, d.out_index, d.amount, d.confirmation_height, d.timeout_sweep_pk_script, d.expiry_sweep_txid, d.finalized_withdrawal_tx, d.swap_hash,
d.id, d.deposit_id, d.tx_hash, d.out_index, d.amount, d.confirmation_height, d.timeout_sweep_pk_script, d.expiry_sweep_txid, d.finalized_withdrawal_tx, d.swap_hash, d.static_address_id,
u.update_state,
u.update_timestamp
FROM
@ -73,6 +73,7 @@ type DepositsForSwapHashRow struct {
ExpirySweepTxid []byte
FinalizedWithdrawalTx sql.NullString
SwapHash []byte
StaticAddressID sql.NullInt32
UpdateState sql.NullString
UpdateTimestamp sql.NullTime
}
@ -97,6 +98,7 @@ func (q *Queries) DepositsForSwapHash(ctx context.Context, swapHash []byte) ([]D
&i.ExpirySweepTxid,
&i.FinalizedWithdrawalTx,
&i.SwapHash,
&i.StaticAddressID,
&i.UpdateState,
&i.UpdateTimestamp,
); err != nil {