File tree Expand file tree Collapse file tree
crates/common/consensus/lean/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -556,23 +556,27 @@ pub fn attestation_data_matches_chain(
556556 historical_block_hashes : & [ B256 ] ,
557557 attestation_data : AttestationData ,
558558) -> anyhow:: Result < bool > {
559- if attestation_data. source . root == B256 :: ZERO || attestation_data. target . root == B256 :: ZERO {
559+ if attestation_data. source . root == B256 :: ZERO
560+ || attestation_data. target . root == B256 :: ZERO
561+ || attestation_data. head . root == B256 :: ZERO
562+ {
560563 return Ok ( false ) ;
561564 }
562565
563566 let source_slot = attestation_data. source . slot as usize ;
564567 let target_slot = attestation_data. target . slot as usize ;
568+ let head_slot = attestation_data. head . slot as usize ;
565569
566- if source_slot >= historical_block_hashes. len ( ) {
567- return Ok ( false ) ;
568- }
569-
570- if target_slot >= historical_block_hashes. len ( ) {
570+ if source_slot >= historical_block_hashes. len ( )
571+ || target_slot >= historical_block_hashes. len ( )
572+ || head_slot >= historical_block_hashes. len ( )
573+ {
571574 return Ok ( false ) ;
572575 }
573576
574577 let matches = attestation_data. source . root == historical_block_hashes[ source_slot]
575- && attestation_data. target . root == historical_block_hashes[ target_slot] ;
578+ && attestation_data. target . root == historical_block_hashes[ target_slot]
579+ && attestation_data. head . root == historical_block_hashes[ head_slot] ;
576580
577581 Ok ( matches)
578582}
You can’t perform that action at this time.
0 commit comments