mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-16 00:48:20 +00:00
Ignore attestations to zero hash
This commit is contained in:
parent
f4621a9f1a
commit
1128de535d
@ -103,15 +103,29 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
|
|||||||
|
|
||||||
let block_hash = attestation.data.target_root;
|
let block_hash = attestation.data.target_root;
|
||||||
|
|
||||||
// TODO: what happens when the target root is not the same slot as the block?
|
// Ignore any attestations to the zero hash.
|
||||||
let block_slot = attestation
|
//
|
||||||
.data
|
// This is an edge case that results from the spec aliasing the zero hash to the genesis
|
||||||
.target_epoch
|
// block. Attesters may attest to the zero hash if they have never seen a block.
|
||||||
.start_slot(T::EthSpec::slots_per_epoch());
|
//
|
||||||
|
// We have two options here:
|
||||||
|
//
|
||||||
|
// 1. Apply all zero-hash attestations to the zero hash.
|
||||||
|
// 2. Ignore all attestations to the zero hash.
|
||||||
|
//
|
||||||
|
// (1) becomes weird once we hit finality and fork choice drops the genesis block. (2) is
|
||||||
|
// fine becuase votes to the genesis block are not usefully, all validators already
|
||||||
|
// implicitly attest to genesis just by being present in the chain.
|
||||||
|
if block_hash != Hash256::zero() {
|
||||||
|
let block_slot = attestation
|
||||||
|
.data
|
||||||
|
.target_epoch
|
||||||
|
.start_slot(T::EthSpec::slots_per_epoch());
|
||||||
|
|
||||||
for validator_index in validator_indices {
|
for validator_index in validator_indices {
|
||||||
self.backend
|
self.backend
|
||||||
.process_message(validator_index, block_hash, block_slot)?;
|
.process_message(validator_index, block_hash, block_slot)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user