From c1e660ef9e0d5675f98ed599c9af446782ffe3e1 Mon Sep 17 00:00:00 2001 From: 0xKitsune <0xKitsune@protonmail.com> Date: Wed, 1 May 2024 17:44:41 -0700 Subject: [PATCH] simulate before broadcasting --- src/contracts/mod.rs | 8 -------- src/ethereum/mod.rs | 6 +----- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/contracts/mod.rs b/src/contracts/mod.rs index cf41e027..5a7ad913 100644 --- a/src/contracts/mod.rs +++ b/src/contracts/mod.rs @@ -260,10 +260,6 @@ impl IdentityManager { ) .tx; - self.ethereum - .simulate_transaction(®ister_identities_transaction) - .await?; - self.ethereum .send_transaction(register_identities_transaction, true) .await @@ -291,10 +287,6 @@ impl IdentityManager { ) .tx; - self.ethereum - .simulate_transaction(&delete_identities_transaction) - .await?; - self.ethereum .send_transaction(delete_identities_transaction, true) .await diff --git a/src/ethereum/mod.rs b/src/ethereum/mod.rs index 0c408096..142a948b 100644 --- a/src/ethereum/mod.rs +++ b/src/ethereum/mod.rs @@ -72,16 +72,12 @@ impl Ethereum { tx: TypedTransaction, only_once: bool, ) -> Result { - self.write_provider.send_transaction(tx, only_once).await - } - - pub async fn simulate_transaction(&self, tx: &TypedTransaction) -> Result<(), TxError> { if let Err(err) = self.read_provider.call(&tx, None).await { tracing::error!("Error simulating transaction: {:?}", err); return Err(TxError::Simulate(anyhow::Error::new(err))); } - Ok(()) + self.write_provider.send_transaction(tx, only_once).await } pub async fn fetch_pending_transactions(&self) -> Result, TxError> {