Skip to content

Commit

Permalink
removed recover simulated tx
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKitsune committed Dec 13, 2023
1 parent 89a93b1 commit 280abf4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
17 changes: 0 additions & 17 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<UnsentTx>> {
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,
Expand Down
5 changes: 0 additions & 5 deletions src/tasks/broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ use crate::broadcast_utils::{
use crate::db::UnsentTx;

pub async fn broadcast_txs(app: Arc<App>) -> 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;
}
}
Expand Down

0 comments on commit 280abf4

Please sign in to comment.