Skip to content

Commit

Permalink
Update to remove orElseThrow
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyeh committed Apr 7, 2024
1 parent 6448efc commit 642c8ee
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,13 @@ public void onSyncStateChanged(final boolean isInSync, final boolean isOptimisti

@VisibleForTesting
boolean isCloseToInSync() {
final UInt64 currentEpoch = recentChainData.getCurrentEpoch().orElseThrow();
final int maxLookaheadEpochs = spec.getSpecConfig(currentEpoch).getMaxSeedLookahead();
final int maxLookaheadSlots = spec.slotsPerEpoch(currentEpoch);
final Optional<UInt64> currentEpoch = recentChainData.getCurrentEpoch();
if (currentEpoch.isEmpty()) {
return false;
}

final int maxLookaheadEpochs = spec.getSpecConfig(currentEpoch.get()).getMaxSeedLookahead();
final int maxLookaheadSlots = spec.slotsPerEpoch(currentEpoch.get());
final int distance = maxLookaheadSlots * maxLookaheadEpochs;

return recentChainData
Expand Down

0 comments on commit 642c8ee

Please sign in to comment.