isLikelySynced property

bool get isLikelySynced

Check if we're likely synced with the network

Implementation

bool get isLikelySynced {
  if (_bestTip == null || activePeerCount < config.minPeersForConsensus) {
    return false;
  }

  final consensusHeight = _calculateConsensusHeight();
  final heightDiff = consensusHeight - _bestTip!.height;

  // Check if tip is current using configurable timeout
  final tipAge = DateTime.now().difference(_bestTip!.lastUpdated);
  final isTipCurrent = tipAge <= config.staleTimeout;

  // Consider synced if within 2 blocks and tip is recent
  return heightDiff <= 2 && isTipCurrent;
}