Fix bug with epoch of attestation votes

This commit is contained in:
Paul Hauner
2020-01-16 09:10:53 +11:00
parent 85e761e563
commit 2366c9ae48
3 changed files with 6 additions and 10 deletions

View File

@@ -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(())