Skip to content

Commit

Permalink
Merge pull request #213 from harmony-dev/fix/fork-choice
Browse files Browse the repository at this point in the history
fork choice implementaion/updates
  • Loading branch information
ericsson49 authored Dec 3, 2019
2 parents 212f836 + 6b1fe0a commit 921244b
Show file tree
Hide file tree
Showing 2 changed files with 391 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,91 @@ public BeaconBlock getHead(

Hash32 headRoot = spec.get_head(new Store() {

@Override
public Time getTime() {
throw new UnsupportedOperationException("not yet implemented");
}

@Override
public void setTime(Time time) {
throw new UnsupportedOperationException("not yet implemented");
}

@Override
public Time getGenesisTime() {
throw new UnsupportedOperationException("not yet implemented");
}

@Override
public Checkpoint getJustifiedCheckpoint() {
return chainStorage.getJustifiedStorage().get().get();
}

@Override
public void setJustifiedCheckpoint(Checkpoint checkpoint) {
chainStorage.getBestJustifiedStorage().set(checkpoint);
}

@Override
public Checkpoint getBestJustifiedCheckpoint() {
return chainStorage.getBestJustifiedStorage().get().get();
}

@Override
public void setBestJustifiedCheckpoint(Checkpoint checkpoint) {
chainStorage.getBestJustifiedStorage().set(checkpoint);
}

@Override
public Checkpoint getFinalizedCheckpoint() {
return chainStorage.getFinalizedStorage().get().get();
}

@Override
public void setFinalizedCheckpoint(Checkpoint checkpoint) {
chainStorage.getFinalizedStorage().set(checkpoint);
}

@Override
public Optional<BeaconState> getCheckpointState(Checkpoint checkpoint) {
throw new UnsupportedOperationException("not yet implemented");
}

@Override
public void setCheckpointState(Checkpoint checkpoint, BeaconState state) {
throw new UnsupportedOperationException("not yet implemented");
}

@Override
public Optional<BeaconBlock> getBlock(Hash32 root) {
return chainStorage.getBlockStorage().get(root);
}

@Override
public void setBlock(Hash32 root, BeaconBlock block) {
throw new UnsupportedOperationException("not yet implemented");
}

@Override
public Optional<BeaconState> getState(Hash32 root) {
return chainStorage.getStateStorage().get(root);
}

@Override
public void setState(Hash32 root, BeaconState state) {
throw new UnsupportedOperationException("not yet implemented");
}

@Override
public Optional<LatestMessage> getLatestMessage(ValidatorIndex index) {
return latestAttestationStorage.apply(index);
}

@Override
public void setLatestMessage(ValidatorIndex index, LatestMessage message) {
throw new UnsupportedOperationException("not yet implemented");
}

@Override
public List<Hash32> getChildren(Hash32 root) {
return chainStorage.getBlockStorage().getChildren(root, SEARCH_LIMIT).stream()
Expand Down
Loading

0 comments on commit 921244b

Please sign in to comment.