Skip to content

Commit

Permalink
Finality update fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsson49 committed Nov 4, 2019
1 parent 7b50b85 commit f090573
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package org.ethereum.beacon.chain;

import static com.google.common.base.Preconditions.checkArgument;

import java.util.List;
import java.util.Optional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.ethereum.beacon.chain.storage.BeaconChainStorage;
Expand All @@ -23,6 +19,11 @@
import org.reactivestreams.Publisher;
import tech.pegasys.artemis.ethereum.core.Hash32;

import java.util.List;
import java.util.Optional;

import static com.google.common.base.Preconditions.checkArgument;

public class DefaultBeaconChain implements MutableBeaconChain {
private static final Logger logger = LogManager.getLogger(DefaultBeaconChain.class);

Expand Down Expand Up @@ -148,7 +149,12 @@ private void updateFinality(BeaconState previous, BeaconState current) {
if (!previous.getFinalizedCheckpoint().equals(current.getFinalizedCheckpoint())) {
chainStorage.getFinalizedStorage().set(current.getFinalizedCheckpoint());
}
if (!previous.getCurrentJustifiedCheckpoint().equals(current.getCurrentJustifiedCheckpoint())) {
if (chainStorage
.getJustifiedStorage()
.get()
.get()
.getEpoch()
.greater(current.getCurrentJustifiedCheckpoint().getEpoch())) {
chainStorage.getJustifiedStorage().set(current.getCurrentJustifiedCheckpoint());
}
}
Expand Down

0 comments on commit f090573

Please sign in to comment.