private Optional<Boolean> currentSyncStatus(
      final ChainHead localChain,
      final Optional<ChainHeadEstimate> syncTargetChain,
      final Optional<ChainHeadEstimate> bestPeerChain) {
    final Optional<Boolean> inSyncWithSyncTarget =
        syncTargetChain.map(remote -> isInSync(localChain, remote));
    final Optional<Boolean> inSyncWithBestPeer =
        bestPeerChain.map(remote -> isInSync(localChain, remote));
    // If we're out of sync with either peer, we're out of sync
    if (inSyncWithSyncTarget.isPresent() && !inSyncWithSyncTarget.get()) {
      return Optional.of(false);
    }
    if (inSyncWithBestPeer.isPresent() && !inSyncWithBestPeer.get()) {
      return Optional.of(false);
    }
    // Otherwise, if either peer is in sync, we're in sync
    return inSyncWithSyncTarget.or(() -> inSyncWithBestPeer);
  }
Tracks the sync status of this node within the specified {@code syncTolerance}.
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/state/InSyncTracker.java