Ensure that parent_block.slot < block.slot

This commit is contained in:
Paul Hauner
2018-10-12 20:54:33 +11:00
parent 1f089d423e
commit e8daca4c80
2 changed files with 26 additions and 0 deletions

View File

@@ -53,6 +53,7 @@ pub enum SszBlockValidationError {
UnknownPoWChainRef,
UnknownParentHash,
BadAttestationSsz,
ParentSlotHigherThanBlockSlot,
AttestationValidationError(AttestationValidationError),
AttestationSignatureFailed,
ProposerAttestationHasObliqueHashes,
@@ -204,6 +205,15 @@ impl<T> BlockValidationContext<T>
}
};
/*
* The parent block slot must be less than the block slot.
*
* In other words, the parent must come before the child.
*/
if parent_block_slot >= block_slot {
return Err(SszBlockValidationError::ParentSlotHigherThanBlockSlot);
}
/*
* Generate the context in which attestations will be validated.
*/