mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
fix: cache slot in check_block_relevancy to prevent TOCTOU (#8776)
Co-Authored-By: radik878 <radikpadik76@gmail.com>
This commit is contained in:
@@ -1798,10 +1798,12 @@ pub fn check_block_relevancy<T: BeaconChainTypes>(
|
||||
) -> Result<Hash256, BlockError> {
|
||||
let block = signed_block.message();
|
||||
|
||||
let present_slot = chain.slot()?;
|
||||
|
||||
// Do not process blocks from the future.
|
||||
if block.slot() > chain.slot()? {
|
||||
if block.slot() > present_slot {
|
||||
return Err(BlockError::FutureSlot {
|
||||
present_slot: chain.slot()?,
|
||||
present_slot,
|
||||
block_slot: block.slot(),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user