diff --git a/src/eth/executor/executor.rs b/src/eth/executor/executor.rs
index 3a9ac909b..78a943fce 100644
--- a/src/eth/executor/executor.rs
+++ b/src/eth/executor/executor.rs
@@ -334,7 +334,7 @@ impl Executor {
// persist state
let tx_execution = TransactionExecution::External(tx_execution);
- self.miner.save_execution(tx_execution)?;
+ self.miner.save_execution(tx_execution, false)?;
// track metrics
#[cfg(feature = "metrics")]
@@ -497,7 +497,7 @@ impl Executor {
// save execution to temporary storage
// in case of failure, retry if conflict or abandon if unexpected error
let tx_execution = TransactionExecution::new_local(tx_input.clone(), evm_result.clone());
- match self.miner.save_execution(tx_execution.clone()) {
+ match self.miner.save_execution(tx_execution.clone(), true) {
Ok(_) => {
return Ok(tx_execution);
}
diff --git a/src/eth/miner/miner.rs b/src/eth/miner/miner.rs
index 0f4ac5e07..5620f831d 100644
--- a/src/eth/miner/miner.rs
+++ b/src/eth/miner/miner.rs
@@ -92,7 +92,7 @@ impl Miner {
}
/// Persists a transaction execution.
- pub fn save_execution(&self, tx_execution: TransactionExecution) -> Result<(), StratusError> {
+ pub fn save_execution(&self, tx_execution: TransactionExecution, check_conflicts: bool) -> Result<(), StratusError> {
// track
#[cfg(feature = "tracing")]
let _span = info_span!("miner::save_execution", tx_hash = %tx_execution.hash()).entered();
@@ -106,7 +106,7 @@ impl Miner {
// save execution to temporary storage
let tx_hash = tx_execution.hash();
- self.storage.save_execution(tx_execution)?;
+ self.storage.save_execution(tx_execution, check_conflicts)?;
// if automine is enabled, automatically mines a block
let _ = self.notifier_pending_txs.send(tx_hash);
diff --git a/src/eth/storage/inmemory/inmemory_temporary.rs b/src/eth/storage/inmemory/inmemory_temporary.rs
index d7b3a5d6b..c78aeff22 100644
--- a/src/eth/storage/inmemory/inmemory_temporary.rs
+++ b/src/eth/storage/inmemory/inmemory_temporary.rs
@@ -145,11 +145,13 @@ impl TemporaryStorage for InMemoryTemporaryStorage {
Ok(())
}
- fn save_execution(&self, tx: TransactionExecution) -> Result<(), StratusError> {
+ fn save_execution(&self, tx: TransactionExecution, check_conflicts: bool) -> Result<(), StratusError> {
// check conflicts
let mut states = self.lock_write();
- if let Some(conflicts) = check_conflicts(&states, tx.execution()) {
- return Err(StratusError::TransactionConflict(conflicts.into()));
+ if check_conflicts {
+ if let Some(conflicts) = do_check_conflicts(&states, tx.execution()) {
+ return Err(StratusError::TransactionConflict(conflicts.into()));
+ }
}
// save account changes
@@ -226,12 +228,12 @@ impl TemporaryStorage for InMemoryTemporaryStorage {
fn read_account(&self, address: &Address) -> anyhow::Result