mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 12:11:59 +00:00
Fix bug with fork choice, tidy
This commit is contained in:
@@ -136,6 +136,9 @@ pub enum AttestationInvalid {
|
||||
delay: u64,
|
||||
attestation: Slot,
|
||||
},
|
||||
/// The attestation is attesting to a state that is later than itself. (Viz., attesting to the
|
||||
/// future).
|
||||
AttestsToFutureState { state: Slot, attestation: Slot },
|
||||
/// Attestation slot is too far in the past to be included in a block.
|
||||
IncludedTooLate { state: Slot, attestation: Slot },
|
||||
/// Attestation target epoch does not match the current or previous epoch.
|
||||
|
||||
@@ -62,6 +62,17 @@ pub fn verify_attestation_for_state<T: EthSpec>(
|
||||
Invalid::BadShard
|
||||
);
|
||||
|
||||
let attestation_slot = state.get_attestation_data_slot(&data)?;
|
||||
|
||||
// An attestation cannot attest to a state that is later than itself.
|
||||
verify!(
|
||||
attestation_slot <= state.slot,
|
||||
Invalid::AttestsToFutureState {
|
||||
state: state.slot,
|
||||
attestation: attestation_slot
|
||||
}
|
||||
);
|
||||
|
||||
// Verify the Casper FFG vote and crosslink data.
|
||||
let parent_crosslink = verify_casper_ffg_vote(attestation, state)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user