Skip to content

Commit

Permalink
Update the query for fetching swept deposits.
Browse files Browse the repository at this point in the history
  • Loading branch information
djordon committed Oct 7, 2024
1 parent 2274668 commit 70798b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions signer/src/storage/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1184,15 +1184,19 @@ impl super::DbRead for PgStore {
, cbb.block_height AS sweep_block_height
, dr.txid
, dr.output_index
, dr.recpipient
, dr.recipient
, dr.amount
FROM sbtc_signer.transactions AS t
JOIN sbtc_signer.bitcoin_transactions AS bt
ON t.txid = bt.txid
JOIN canonical_bitcoin_blockchain AS cbb
ON bt.block_hash = cbb.block_hash
CROSS JOIN sbtc_signer.deposit_requests AS dr
WHERE t.tx_type = 'sbtc_transaction'
LEFT JOIN sbtc_signer.completed_deposit_events AS cde
ON cde.bitcoin_txid = dr.txid
AND cde.output_index = dr.output_index
WHERE cde.bitcoin_txid IS NULL
AND t.tx_type = 'sbtc_transaction'
ORDER BY t.created_at DESC
LIMIT 1
"#,
Expand Down

0 comments on commit 70798b0

Please sign in to comment.