chore(consensus): Clear up the naming and intention behind checks (#2415)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
rakita
2023-04-26 18:04:36 +02:00
committed by GitHub
parent 57a19f91f0
commit 837555e296
10 changed files with 59 additions and 28 deletions

View File

@ -23,18 +23,21 @@ impl BeaconConsensus {
}
impl Consensus for BeaconConsensus {
fn pre_validate_header(
fn validate_header(&self, header: &SealedHeader) -> Result<(), ConsensusError> {
validation::validate_header_standalone(header, &self.chain_spec)?;
Ok(())
}
fn validate_header_agains_parent(
&self,
header: &SealedHeader,
parent: &SealedHeader,
) -> Result<(), ConsensusError> {
validation::validate_header_standalone(header, &self.chain_spec)?;
validation::validate_header_regarding_parent(parent, header, &self.chain_spec)?;
Ok(())
}
fn validate_header(
fn validate_header_with_total_difficulty(
&self,
header: &Header,
total_difficulty: U256,
@ -76,7 +79,7 @@ impl Consensus for BeaconConsensus {
Ok(())
}
fn pre_validate_block(&self, block: &SealedBlock) -> Result<(), ConsensusError> {
fn validate_block(&self, block: &SealedBlock) -> Result<(), ConsensusError> {
validation::validate_block_standalone(block, &self.chain_spec)
}
}