mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-20 13:27:50 +02:00
staticaddr/deposit: restore owning address parameters
Join each selected deposit with its persisted static-address row during loop-in recovery. Hydrate legacy rows as needed so restored swaps retain the scripts and key locators required for signing.
This commit is contained in:
parent
94a499237b
commit
d1b29e0bb5
9 changed files with 348 additions and 64 deletions
|
|
@ -46,10 +46,19 @@ 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.static_address_id,
|
||||
sa.client_pubkey client_pubkey,
|
||||
sa.server_pubkey server_pubkey,
|
||||
sa.expiry expiry,
|
||||
sa.client_key_family client_key_family,
|
||||
sa.client_key_index client_key_index,
|
||||
sa.pkscript pkscript,
|
||||
sa.protocol_version protocol_version,
|
||||
sa.initiation_height initiation_height,
|
||||
u.update_state,
|
||||
u.update_timestamp
|
||||
FROM
|
||||
deposits d
|
||||
LEFT JOIN static_addresses sa ON sa.id = d.static_address_id
|
||||
LEFT JOIN
|
||||
deposit_updates u ON u.id = (
|
||||
SELECT id
|
||||
|
|
@ -74,6 +83,14 @@ type DepositsForSwapHashRow struct {
|
|||
FinalizedWithdrawalTx sql.NullString
|
||||
SwapHash []byte
|
||||
StaticAddressID sql.NullInt32
|
||||
ClientPubkey []byte
|
||||
ServerPubkey []byte
|
||||
Expiry sql.NullInt32
|
||||
ClientKeyFamily sql.NullInt32
|
||||
ClientKeyIndex sql.NullInt32
|
||||
Pkscript []byte
|
||||
ProtocolVersion sql.NullInt32
|
||||
InitiationHeight sql.NullInt32
|
||||
UpdateState sql.NullString
|
||||
UpdateTimestamp sql.NullTime
|
||||
}
|
||||
|
|
@ -99,6 +116,14 @@ func (q *Queries) DepositsForSwapHash(ctx context.Context, swapHash []byte) ([]D
|
|||
&i.FinalizedWithdrawalTx,
|
||||
&i.SwapHash,
|
||||
&i.StaticAddressID,
|
||||
&i.ClientPubkey,
|
||||
&i.ServerPubkey,
|
||||
&i.Expiry,
|
||||
&i.ClientKeyFamily,
|
||||
&i.ClientKeyIndex,
|
||||
&i.Pkscript,
|
||||
&i.ProtocolVersion,
|
||||
&i.InitiationHeight,
|
||||
&i.UpdateState,
|
||||
&i.UpdateTimestamp,
|
||||
); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue