Interface SynchronizationService

All Superinterfaces:
BesuService

public interface SynchronizationService extends BesuService
Synchronization service wraps the sync state and sync event lifecycle.
  • Method Details

    • fireNewUnverifiedForkchoiceEvent

      void fireNewUnverifiedForkchoiceEvent(org.hyperledger.besu.datatypes.Hash head, org.hyperledger.besu.datatypes.Hash safeBlock, org.hyperledger.besu.datatypes.Hash finalizedBlock)
      Enables P2P discovery.
      Parameters:
      head - the head of the chain.
      safeBlock - the safe block.
      finalizedBlock - the finalized block.
    • setHead

      boolean setHead(BlockHeader blockHeader, BlockBody blockBody)
      Set the head of the chain.
      Parameters:
      blockHeader - the block header
      blockBody - the block body
      Returns:
      true if the head was set, false otherwise.
    • setHeadUnsafe

      boolean setHeadUnsafe(BlockHeader blockHeader, BlockBody blockBody)
      Adds the block header and body to the head of the chain directly, without using a block importer or validation.
      Parameters:
      blockHeader - the block header
      blockBody - the block body
      Returns:
      true if the head was set, false otherwise.
    • isInitialSyncPhaseDone

      boolean isInitialSyncPhaseDone()
      Returns whether the initial chain and worldstate sync is complete.
      Returns:
      true if the initial sync phase is done, false otherwise.
    • disableWorldStateTrie

      void disableWorldStateTrie()
      Disables the worldstate trie for update.
    • stop

      void stop()
      Stops the synchronizer.
    • start

      void start()
      Starts the synchronizer.
    • getSyncStatus

      Optional<SyncStatus> getSyncStatus()
      Returns the current sync status.
      Returns:
      the current sync status, or empty if not syncing.
    • isInSync

      boolean isInSync()
      Checks if the node is in sync.
      Returns:
      true if the node is in sync, false otherwise.
    • getBestPeerChainHead

      Optional<Long> getBestPeerChainHead()
      Returns the best peer chain head.
      Returns:
      the best peer chain head, or empty if no peers are connected.