From e0e43509d8141aabd845b521fc57d73c6bb56dad Mon Sep 17 00:00:00 2001 From: Dzejkop Date: Mon, 11 Dec 2023 13:38:41 +0100 Subject: [PATCH] Fix --- src/db.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/db.rs b/src/db.rs index f4262f3..768a60d 100644 --- a/src/db.rs +++ b/src/db.rs @@ -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) @@ -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?;