Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzejkop committed Dec 11, 2023
1 parent 6de73df commit e0e4350
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,12 +1025,11 @@ impl Database {
}

pub async fn purge_unsent_txs(&self, relayer_id: &str) -> eyre::Result<()> {
let (nonce,): (i64,) = sqlx::query_as(
sqlx::query(
r#"
UPDATE relayers
SET nonce = current_nonce
WHERE id = $1
RETURNING nonce
"#,
)
.bind(relayer_id)
Expand All @@ -1040,13 +1039,13 @@ impl Database {
sqlx::query(
r#"
DELETE FROM transactions
WHERE nonce > $1
WHERE t.relayer_id = $1
AND id NOT IN (
SELECT tx_id FROM sent_transactions
)
"#,
)
.bind(nonce)
.bind(relayer_id)
.execute(&self.pool)
.await?;

Expand Down

0 comments on commit e0e4350

Please sign in to comment.