Ignore unknown blocks at fork choice

This commit is contained in:
Paul Hauner 2019-08-09 12:34:56 +10:00
parent 67fe21c1c0
commit f4121d9deb
No known key found for this signature in database
GPG Key ID: 5E2CFF9B75FA63DF

View File

@ -119,12 +119,14 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
// //
// https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_fork-choice.md // https://github.com/ethereum/eth2.0-specs/blob/v0.7.0/specs/core/0_fork-choice.md
for attestation in &block.body.attestations { for attestation in &block.body.attestations {
let block = self // If the `data.beacon_block_root` block is not known to us, simply ignore the latest
// vote.
if let Some(block) = self
.store .store
.get::<BeaconBlock<T::EthSpec>>(&attestation.data.beacon_block_root)? .get::<BeaconBlock<T::EthSpec>>(&attestation.data.beacon_block_root)?
.ok_or_else(|| Error::MissingBlock(attestation.data.beacon_block_root))?; {
self.process_attestation(state, attestation, &block)?;
self.process_attestation(state, attestation, &block)?; }
} }
// This does not apply a vote to the block, it just makes fork choice aware of the block so // This does not apply a vote to the block, it just makes fork choice aware of the block so