@Test public void getLatestFinalizedBlockAndState_fromUnderlyingStore() { final UpdatableStore store = createGenesisStore(); final SignedBlockAndState expected = store.getLatestFinalizedBlockAndState(); final StoreTransaction tx = store.startTransaction(storageUpdateChannel); assertThat(tx.getLatestFinalizedBlockAndState()).isEqualTo(expected); }
@Override public SignedBlockAndState getLatestFinalizedBlockAndState() { if (finalized_checkpoint.isPresent()) { return retrieveBlockAndState(finalized_checkpoint.get().getRoot()).join().orElseThrow(); } return store.getLatestFinalizedBlockAndState(); }
StoreTransaction implements UpdatableStore.StoreTransaction { @Override public SignedBlockAndState getLatestFinalizedBlockAndState() { if (finalized_checkpoint.isPresent()) { return retrieveBlockAndState(finalized_checkpoint.get().getRoot()).join().orElseThrow(); } return store.getLatestFinalizedBlockAndState(); } }
StoreTransaction implements UpdatableStore.StoreTransaction { @Override public SignedBlockAndState getLatestFinalizedBlockAndState() { if (finalized_checkpoint.isPresent()) { return retrieveBlockAndState(finalized_checkpoint.get().getRoot()).join().orElseThrow(); } return store.getLatestFinalizedBlockAndState(); } StoreTransaction(
      final Store store,
      final ReadWriteLock lock,
      final StorageUpdateChannel storageUpdateChannel,
      final UpdatableStore.StoreUpdateHandler updateHandler); }
StoreTransaction implements UpdatableStore.StoreTransaction { @Override public SignedBlockAndState getLatestFinalizedBlockAndState() { if (finalized_checkpoint.isPresent()) { return retrieveBlockAndState(finalized_checkpoint.get().getRoot()).join().orElseThrow(); } return store.getLatestFinalizedBlockAndState(); } StoreTransaction(
      final Store store,
      final ReadWriteLock lock,
      final StorageUpdateChannel storageUpdateChannel,
      final UpdatableStore.StoreUpdateHandler updateHandler); @Override void putBlockAndState(final SignedBeaconBlock block, final BeaconState state); @Override void putBlockAndState(final SignedBlockAndState blockAndState); @Override void putStateRoot(final Bytes32 stateRoot, final SlotAndBlockRoot slotAndBlockRoot); @Override void setTime(UInt64 time); @Override void setGenesis_time(UInt64 genesis_time); @Override void setJustifiedCheckpoint(Checkpoint justified_checkpoint); @Override void setFinalizedCheckpoint(Checkpoint finalized_checkpoint); @Override void setBestJustifiedCheckpoint(Checkpoint best_justified_checkpoint); @Override VoteTracker getVote(UInt64 validatorIndex); @CheckReturnValue @Override SafeFuture<Void> commit(); @Override void commit(final Runnable onSuccess, final String errorMessage); @Override UInt64 getTime(); @Override UInt64 getGenesisTime(); @Override Checkpoint getJustifiedCheckpoint(); @Override Checkpoint getFinalizedCheckpoint(); @Override SignedBlockAndState getLatestFinalizedBlockAndState(); @Override UInt64 getLatestFinalizedBlockSlot(); @Override Checkpoint getBestJustifiedCheckpoint(); @Override boolean containsBlock(final Bytes32 blockRoot); @Override Set<Bytes32> getBlockRoots(); @Override List<Bytes32> getOrderedBlockRoots(); @Override Optional<BeaconState> getBlockStateIfAvailable(final Bytes32 blockRoot); @Override SafeFuture<Optional<SignedBeaconBlock>> retrieveSignedBlock(Bytes32 blockRoot); @Override SafeFuture<Optional<SignedBlockAndState>> retrieveBlockAndState(Bytes32 blockRoot); @Override SafeFuture<Optional<BeaconState>> retrieveBlockState(Bytes32 blockRoot); @Override SafeFuture<Optional<BeaconState>> retrieveCheckpointState(Checkpoint checkpoint); @Override SafeFuture<CheckpointState> retrieveFinalizedCheckpointAndState(); @Override SafeFuture<Optional<BeaconState>> retrieveCheckpointState(
      final Checkpoint checkpoint, final BeaconState latestStateAtEpoch); @Override Optional<SignedBeaconBlock> getBlockIfAvailable(final Bytes32 blockRoot); @Override Set<UInt64> getVotedValidatorIndices(); }
StoreTransaction implements UpdatableStore.StoreTransaction { @Override public SignedBlockAndState getLatestFinalizedBlockAndState() { if (finalized_checkpoint.isPresent()) { return retrieveBlockAndState(finalized_checkpoint.get().getRoot()).join().orElseThrow(); } return store.getLatestFinalizedBlockAndState(); } StoreTransaction(
      final Store store,
      final ReadWriteLock lock,
      final StorageUpdateChannel storageUpdateChannel,
      final UpdatableStore.StoreUpdateHandler updateHandler); @Override void putBlockAndState(final SignedBeaconBlock block, final BeaconState state); @Override void putBlockAndState(final SignedBlockAndState blockAndState); @Override void putStateRoot(final Bytes32 stateRoot, final SlotAndBlockRoot slotAndBlockRoot); @Override void setTime(UInt64 time); @Override void setGenesis_time(UInt64 genesis_time); @Override void setJustifiedCheckpoint(Checkpoint justified_checkpoint); @Override void setFinalizedCheckpoint(Checkpoint finalized_checkpoint); @Override void setBestJustifiedCheckpoint(Checkpoint best_justified_checkpoint); @Override VoteTracker getVote(UInt64 validatorIndex); @CheckReturnValue @Override SafeFuture<Void> commit(); @Override void commit(final Runnable onSuccess, final String errorMessage); @Override UInt64 getTime(); @Override UInt64 getGenesisTime(); @Override Checkpoint getJustifiedCheckpoint(); @Override Checkpoint getFinalizedCheckpoint(); @Override SignedBlockAndState getLatestFinalizedBlockAndState(); @Override UInt64 getLatestFinalizedBlockSlot(); @Override Checkpoint getBestJustifiedCheckpoint(); @Override boolean containsBlock(final Bytes32 blockRoot); @Override Set<Bytes32> getBlockRoots(); @Override List<Bytes32> getOrderedBlockRoots(); @Override Optional<BeaconState> getBlockStateIfAvailable(final Bytes32 blockRoot); @Override SafeFuture<Optional<SignedBeaconBlock>> retrieveSignedBlock(Bytes32 blockRoot); @Override SafeFuture<Optional<SignedBlockAndState>> retrieveBlockAndState(Bytes32 blockRoot); @Override SafeFuture<Optional<BeaconState>> retrieveBlockState(Bytes32 blockRoot); @Override SafeFuture<Optional<BeaconState>> retrieveCheckpointState(Checkpoint checkpoint); @Override SafeFuture<CheckpointState> retrieveFinalizedCheckpointAndState(); @Override SafeFuture<Optional<BeaconState>> retrieveCheckpointState(
      final Checkpoint checkpoint, final BeaconState latestStateAtEpoch); @Override Optional<SignedBeaconBlock> getBlockIfAvailable(final Bytes32 blockRoot); @Override Set<UInt64> getVotedValidatorIndices();  }