mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 05:48:31 +00:00
Fix invalid attestation verification condition (#1321)
* Fix bug with attestation target * Change comment wording
This commit is contained in:
@@ -608,10 +608,20 @@ where
|
||||
beacon_block_root: indexed_attestation.data.beacon_block_root,
|
||||
})?;
|
||||
|
||||
if block.target_root != target.root {
|
||||
// If an attestation points to a block that is from an earlier slot than the attestation,
|
||||
// then all slots between the block and attestation must be skipped. Therefore if the block
|
||||
// is from a prior epoch to the attestation, then the target root must be equal to the root
|
||||
// of the block that is being attested to.
|
||||
let expected_target = if target.epoch > block.slot.epoch(E::slots_per_epoch()) {
|
||||
indexed_attestation.data.beacon_block_root
|
||||
} else {
|
||||
block.target_root
|
||||
};
|
||||
|
||||
if expected_target != target.root {
|
||||
return Err(InvalidAttestation::InvalidTarget {
|
||||
attestation: target.root,
|
||||
local: block.target_root,
|
||||
local: expected_target,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user