diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index abbef29081..95ce1bbecd 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -1057,10 +1057,7 @@ impl BeaconChain { { // Provide the attestation to fork choice, updating the validator latest messages but // _without_ finding and updating the head. - if let Err(e) = self - .fork_choice - .process_attestation(&state, &attestation, block) - { + if let Err(e) = self.fork_choice.process_attestation(&state, &attestation) { error!( self.log, "Add attestation to fork choice failed"; diff --git a/beacon_node/beacon_chain/src/fork_choice.rs b/beacon_node/beacon_chain/src/fork_choice.rs index b18dda9a1e..43bb588963 100644 --- a/beacon_node/beacon_chain/src/fork_choice.rs +++ b/beacon_node/beacon_chain/src/fork_choice.rs @@ -285,7 +285,7 @@ impl ForkChoice { .backend .contains_block(&attestation.data.beacon_block_root) { - self.process_attestation(state, attestation, block)?; + self.process_attestation(state, attestation)?; } } @@ -311,7 +311,6 @@ impl ForkChoice { &self, state: &BeaconState, attestation: &Attestation, - block: &BeaconBlock, ) -> Result<()> { let timer = metrics::start_timer(&metrics::FORK_CHOICE_PROCESS_ATTESTATION_TIMES); @@ -340,7 +339,7 @@ impl ForkChoice { self.backend.process_attestation( validator_index, block_hash, - block.slot.epoch(T::EthSpec::slots_per_epoch()), + attestation.data.target.epoch, )?; } } diff --git a/eth2/proto_array_fork_choice/src/lib.rs b/eth2/proto_array_fork_choice/src/lib.rs index a21c73154a..267f35e37a 100644 --- a/eth2/proto_array_fork_choice/src/lib.rs +++ b/eth2/proto_array_fork_choice/src/lib.rs @@ -130,14 +130,14 @@ impl ProtoArrayForkChoice { &self, validator_index: usize, block_root: Hash256, - block_epoch: Epoch, + target_epoch: Epoch, ) -> Result<(), String> { let mut votes = self.votes.write(); let vote = votes.get_mut(validator_index); - if block_epoch > vote.next_epoch || *vote == VoteTracker::default() { + if target_epoch > vote.next_epoch || *vote == VoteTracker::default() { vote.next_root = block_root; - vote.next_epoch = block_epoch; + vote.next_epoch = target_epoch; } Ok(())