mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: unwind on execution and senders errors (#2938)
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
This commit is contained in:
@ -11,7 +11,7 @@ use reth_interfaces::{
|
||||
BlockStatus, CanonicalOutcome,
|
||||
},
|
||||
consensus::{Consensus, ConsensusError},
|
||||
executor::BlockExecutionError,
|
||||
executor::{BlockExecutionError, BlockValidationError},
|
||||
Error,
|
||||
};
|
||||
use reth_primitives::{
|
||||
@ -378,7 +378,7 @@ impl<DB: Database, C: Consensus, EF: ExecutorFactory> BlockchainTree<DB, C, EF>
|
||||
if !self.externals.chain_spec.fork(Hardfork::Paris).active_at_ttd(parent_td, U256::ZERO)
|
||||
{
|
||||
return Err(InsertBlockError::execution_error(
|
||||
BlockExecutionError::BlockPreMerge { hash: block.hash },
|
||||
BlockValidationError::BlockPreMerge { hash: block.hash }.into(),
|
||||
block.block,
|
||||
))
|
||||
}
|
||||
@ -869,14 +869,16 @@ impl<DB: Database, C: Consensus, EF: ExecutorFactory> BlockchainTree<DB, C, EF>
|
||||
// If block is already canonical don't return error.
|
||||
if let Some(header) = self.find_canonical_header(block_hash)? {
|
||||
info!(target: "blockchain_tree", ?block_hash, "Block is already canonical, ignoring.");
|
||||
let td = self
|
||||
.externals
|
||||
.database()
|
||||
.provider()?
|
||||
.header_td(block_hash)?
|
||||
.ok_or(BlockExecutionError::MissingTotalDifficulty { hash: *block_hash })?;
|
||||
let td = self.externals.database().provider()?.header_td(block_hash)?.ok_or(
|
||||
BlockExecutionError::from(BlockValidationError::MissingTotalDifficulty {
|
||||
hash: *block_hash,
|
||||
}),
|
||||
)?;
|
||||
if !self.externals.chain_spec.fork(Hardfork::Paris).active_at_ttd(td, U256::ZERO) {
|
||||
return Err(BlockExecutionError::BlockPreMerge { hash: *block_hash }.into())
|
||||
return Err(BlockExecutionError::from(BlockValidationError::BlockPreMerge {
|
||||
hash: *block_hash,
|
||||
})
|
||||
.into())
|
||||
}
|
||||
return Ok(CanonicalOutcome::AlreadyCanonical { header })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user