diff --git a/eth2/state_processing/src/per_block_processing.rs b/eth2/state_processing/src/per_block_processing.rs index 56238f9c2..016abe809 100644 --- a/eth2/state_processing/src/per_block_processing.rs +++ b/eth2/state_processing/src/per_block_processing.rs @@ -77,15 +77,12 @@ fn per_block_processing_signature_optional( should_verify_block_signature: bool, spec: &ChainSpec, ) -> Result<(), Error> { - process_block_header(state, block, spec)?; + process_block_header(state, block, spec, should_verify_block_signature)?; // Ensure the current and previous epoch caches are built. state.build_committee_cache(RelativeEpoch::Previous, spec)?; state.build_committee_cache(RelativeEpoch::Current, spec)?; - if should_verify_block_signature { - verify_block_signature(&state, &block, &spec)?; - } process_randao(&mut state, &block, &spec)?; process_eth1_data(&mut state, &block.body.eth1_data, spec)?; process_proposer_slashings(&mut state, &block.body.proposer_slashings, spec)?; @@ -105,6 +102,7 @@ pub fn process_block_header( state: &mut BeaconState, block: &BeaconBlock, spec: &ChainSpec, + should_verify_block_signature: bool, ) -> Result<(), Error> { verify!(block.slot == state.slot, Invalid::StateSlotMismatch); @@ -125,6 +123,10 @@ pub fn process_block_header( let proposer = &state.validator_registry[proposer_idx]; verify!(!proposer.slashed, Invalid::ProposerSlashed(proposer_idx)); + if should_verify_block_signature { + verify_block_signature(&state, &block, &spec)?; + } + Ok(()) }