mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
refactor: various cleanups (#1833)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
committed by
GitHub
parent
995c5ad5d1
commit
075544e889
@ -282,13 +282,9 @@ impl<Client: HeaderProvider + BlockProvider + StateProviderFactory + EvmEnvProvi
|
||||
return Ok(PayloadStatus::from_status(PayloadStatusEnum::Syncing))
|
||||
};
|
||||
|
||||
let parent_td = if let Some(parent_td) = self.client.header_td(&block.parent_hash)? {
|
||||
parent_td
|
||||
} else {
|
||||
return Ok(PayloadStatus::from_status(PayloadStatusEnum::Invalid {
|
||||
let Some(parent_td) = self.client.header_td(&block.parent_hash)? else { return Ok(PayloadStatus::from_status(PayloadStatusEnum::Invalid {
|
||||
validation_error: EngineApiError::PayloadPreMerge.to_string(),
|
||||
}))
|
||||
};
|
||||
})) };
|
||||
|
||||
// Short circuit the check by passing parent total difficulty.
|
||||
if !self.chain_spec.fork(Hardfork::Paris).active_at_ttd(parent_td, U256::ZERO) {
|
||||
@ -352,23 +348,18 @@ impl<Client: HeaderProvider + BlockProvider + StateProviderFactory + EvmEnvProvi
|
||||
}))
|
||||
}
|
||||
|
||||
let head = if let Some(head) = self.client.header(&head_block_hash)? {
|
||||
head
|
||||
} else {
|
||||
// Block is not known, nothing to do.
|
||||
return Ok(ForkchoiceUpdated::from_status(PayloadStatusEnum::Syncing))
|
||||
};
|
||||
let Some(head) = self.client.header(&head_block_hash)? else {
|
||||
// Block is not known, nothing to do
|
||||
return Ok(ForkchoiceUpdated::from_status(PayloadStatusEnum::Syncing)) };
|
||||
|
||||
// The finalized block hash is not known, we are still syncing
|
||||
if !finalized_block_hash.is_zero() && !self.client.is_known(&finalized_block_hash)? {
|
||||
return Ok(ForkchoiceUpdated::from_status(PayloadStatusEnum::Syncing))
|
||||
}
|
||||
|
||||
let head_td = if let Some(head_td) = self.client.header_td(&head_block_hash)? {
|
||||
head_td
|
||||
} else {
|
||||
// internal error - we have the head block but not the total difficulty
|
||||
return Ok(ForkchoiceUpdated::from_status(PayloadStatusEnum::Invalid {
|
||||
let Some(head_td) = self.client.header_td(&head_block_hash)? else {
|
||||
// internal error - we have the head block but not the total difficulty
|
||||
return Ok(ForkchoiceUpdated::from_status(PayloadStatusEnum::Invalid {
|
||||
validation_error: EngineApiError::Internal(
|
||||
reth_interfaces::provider::ProviderError::TotalDifficulty {
|
||||
number: head.number,
|
||||
@ -376,8 +367,7 @@ impl<Client: HeaderProvider + BlockProvider + StateProviderFactory + EvmEnvProvi
|
||||
.into(),
|
||||
)
|
||||
.to_string(),
|
||||
}))
|
||||
};
|
||||
})) };
|
||||
|
||||
// From the Engine API spec:
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user