def _compare_chain_tip_and_finalized_epoch(self, peer_finalized_epoch: Epoch, peer_head_slot: Slot) -> None:
    checkpoint = self.chain.get_head_state().finalized_checkpoint
    head_block = self.chain.get_canonical_head()
    peer_has_higher_finalized_epoch = (peer_finalized_epoch > checkpoint.epoch)
    peer_has_equal_finalized_epoch = (peer_finalized_epoch == checkpoint.epoch)
    peer_has_higher_head_slot = (peer_head_slot > head_block.slot)
    if (peer_has_higher_finalized_epoch or (peer_has_equal_finalized_epoch and peer_has_higher_head_slot)):
        self.logger.debug("Peer's chain is ahead of us, start syncing with the peer.")
        pass
def _compare_chain_tip_and_finalized_epoch(self, peer_finalized_epoch: Epoch, peer_head_slot: Slot) -> None:
    checkpoint = self.chain.get_head_state().finalized_checkpoint
    head_block = self.chain.get_canonical_head()
    peer_has_higher_finalized_epoch = (peer_finalized_epoch > checkpoint.epoch)
    peer_has_equal_finalized_epoch = (peer_finalized_epoch == checkpoint.epoch)
    peer_has_higher_head_slot = (peer_head_slot > head_block.slot)
    if (peer_has_higher_finalized_epoch or (peer_has_equal_finalized_epoch and peer_has_higher_head_slot)):
        self.logger.debug("Peer's chain is ahead of us, start syncing with the peer.")
        pass