mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-21 23:08:23 +00:00
test fixes
This commit is contained in:
@@ -178,6 +178,11 @@ pub enum InvalidAttestation {
|
||||
/// A same-slot attestation has a non-zero index, indicating a payload attestation during the
|
||||
/// same slot as the block. Payload attestations must only arrive in subsequent slots.
|
||||
PayloadAttestationDuringSameSlot { slot: Slot },
|
||||
/// A gossip payload attestation must be for the current slot.
|
||||
PayloadAttestationNotCurrentSlot {
|
||||
attestation_slot: Slot,
|
||||
current_slot: Slot,
|
||||
},
|
||||
}
|
||||
|
||||
impl<T> From<String> for Error<T> {
|
||||
@@ -1139,7 +1144,7 @@ where
|
||||
fn validate_on_payload_attestation(
|
||||
&self,
|
||||
indexed_payload_attestation: &IndexedPayloadAttestation<E>,
|
||||
_is_from_block: bool,
|
||||
is_from_block: bool,
|
||||
) -> Result<(), InvalidAttestation> {
|
||||
if indexed_payload_attestation.attesting_indices.is_empty() {
|
||||
return Err(InvalidAttestation::EmptyAggregationBitfield);
|
||||
@@ -1159,6 +1164,17 @@ where
|
||||
});
|
||||
}
|
||||
|
||||
// Gossip payload attestations must be for the current slot.
|
||||
// https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/fork-choice.md
|
||||
if !is_from_block
|
||||
&& indexed_payload_attestation.data.slot != self.fc_store.get_current_slot()
|
||||
{
|
||||
return Err(InvalidAttestation::PayloadAttestationNotCurrentSlot {
|
||||
attestation_slot: indexed_payload_attestation.data.slot,
|
||||
current_slot: self.fc_store.get_current_slot(),
|
||||
});
|
||||
}
|
||||
|
||||
if self.fc_store.get_current_slot() == block.slot
|
||||
&& indexed_payload_attestation.data.payload_present
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user