Package com.privatechain.network.sync


package com.privatechain.network.sync
Chain synchronization and fork resolution — brings a node's local chain up to date with the network on startup and after a network partition (FR-NET-04, FR-NET-05).

Classes in this package:

  • SyncManager — on node start, broadcasts a GET_STATUS request to all peers, collects their chain heights, and requests missing blocks from the peer reporting the highest height. Also triggered after a partition is detected (NFR-REL-02).
  • BlockFetcher — requests a range of blocks from a specific remote peer and validates each block via ConsensusEngine before appending it to the local chain.
  • ForkResolver — when two competing chain tips are detected, selects the chain with the greater cumulative difficulty as the canonical chain and publishes BlockchainEvent.ForkDetectedEvent (FR-NET-05).
Since:
1.0.0
  • Classes
    Class
    Description
    Fetches missing blocks from a specific remote peer during chain synchronization.
    Resolves chain forks by selecting the canonical chain according to the longest-chain (greatest cumulative difficulty) rule (FR-NET-05).
    Synchronizes the local blockchain with the P2P network on node startup and after partition recovery (FR-NET-04, design.md §4.3).