mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 17:26:04 +00:00
Fix bug with epoch of attestation votes
This commit is contained in:
@@ -1057,10 +1057,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
{
|
||||
// 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";
|
||||
|
||||
@@ -285,7 +285,7 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
|
||||
.backend
|
||||
.contains_block(&attestation.data.beacon_block_root)
|
||||
{
|
||||
self.process_attestation(state, attestation, block)?;
|
||||
self.process_attestation(state, attestation)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,6 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
|
||||
&self,
|
||||
state: &BeaconState<T::EthSpec>,
|
||||
attestation: &Attestation<T::EthSpec>,
|
||||
block: &BeaconBlock<T::EthSpec>,
|
||||
) -> Result<()> {
|
||||
let timer = metrics::start_timer(&metrics::FORK_CHOICE_PROCESS_ATTESTATION_TIMES);
|
||||
|
||||
@@ -340,7 +339,7 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
|
||||
self.backend.process_attestation(
|
||||
validator_index,
|
||||
block_hash,
|
||||
block.slot.epoch(T::EthSpec::slots_per_epoch()),
|
||||
attestation.data.target.epoch,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(())
|
||||
|
||||
Reference in New Issue
Block a user