From 280abf4415d060bb93082521e6351671e5df9265 Mon Sep 17 00:00:00 2001 From: 0xKitsune <0xKitsune@protonmail.com> Date: Wed, 13 Dec 2023 18:30:58 -0500 Subject: [PATCH] removed recover simulated tx --- src/db.rs | 17 ----------------- src/tasks/broadcast.rs | 5 ----- 2 files changed, 22 deletions(-) diff --git a/src/db.rs b/src/db.rs index fa413f1..269e9b6 100644 --- a/src/db.rs +++ b/src/db.rs @@ -292,23 +292,6 @@ impl Database { Ok(()) } - // Gets all transactions that were simulated but not sent - pub async fn recover_simulated_txs(&self) -> eyre::Result> { - Ok(sqlx::query_as( - r#" - SELECT r.id as relayer_id, t.id, t.tx_to, t.data, t.value, t.gas_limit, t.priority, t.nonce, r.key_id, r.chain_id - FROM transactions t - INNER JOIN tx_hashes h ON (h.tx_id = t.id) - INNER JOIN relayers r ON (t.relayer_id = r.id - LEFT JOIN sent_transactions s ON (t.id = s.tx_id) - WHERE s.tx_id IS NULL - ORDER BY r.id, t.nonce ASC; - "#, - ) - .fetch_all(&self.pool) - .await?) - } - pub async fn get_latest_block_number_without_fee_estimates( &self, chain_id: u64, diff --git a/src/tasks/broadcast.rs b/src/tasks/broadcast.rs index c4b47c6..eb3ab9a 100644 --- a/src/tasks/broadcast.rs +++ b/src/tasks/broadcast.rs @@ -18,15 +18,10 @@ use crate::broadcast_utils::{ use crate::db::UnsentTx; pub async fn broadcast_txs(app: Arc) -> eyre::Result<()> { - // Recovery any unsent transactions that were simulated but never sent - let recovered_txs = app.db.recover_simulated_txs().await?; - broadcast_unsent_txs(&app, recovered_txs).await?; - loop { // Get all unsent txs and broadcast let txs = app.db.get_unsent_txs().await?; broadcast_unsent_txs(&app, txs).await?; - tokio::time::sleep(Duration::from_secs(1)).await; } }