Interface SynchronizationService

All Superinterfaces:
org.hyperledger.besu.plugin.services.BesuService

public interface SynchronizationService extends org.hyperledger.besu.plugin.services.BesuService
Synchronization service wraps the sync state and sync event lifecycle.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Disables the worldstate trie for update.
    void
    fireNewUnverifiedForkchoiceEvent(org.hyperledger.besu.datatypes.Hash head, org.hyperledger.besu.datatypes.Hash safeBlock, org.hyperledger.besu.datatypes.Hash finalizedBlock)
    Fires a new unverified forkchoice event on the merge context and records the safe and finalized blocks on the blockchain.
    Returns the best peer chain head.
    Returns the current sync status.
    boolean
    Returns whether the initial chain and worldstate sync is complete.
    boolean
    Checks if the node is in sync.
    boolean
    setHead(org.hyperledger.besu.plugin.data.BlockHeader blockHeader, org.hyperledger.besu.plugin.data.BlockBody blockBody)
    Set the head of the chain.
    boolean
    setHeadUnsafe(org.hyperledger.besu.plugin.data.BlockHeader blockHeader, org.hyperledger.besu.plugin.data.BlockBody blockBody)
    Adds the block header and body to the head of the chain directly, without using a block importer or validation.
    void
    Starts the synchronizer.
    void
    Stops the synchronizer.
  • Method Details

    • fireNewUnverifiedForkchoiceEvent

      void fireNewUnverifiedForkchoiceEvent(org.hyperledger.besu.datatypes.Hash head, org.hyperledger.besu.datatypes.Hash safeBlock, org.hyperledger.besu.datatypes.Hash finalizedBlock)
      Fires a new unverified forkchoice event on the merge context and records the safe and finalized blocks on the blockchain.
      Parameters:
      head - the head of the chain.
      safeBlock - the safe block.
      finalizedBlock - the finalized block.
    • setHead

      boolean setHead(org.hyperledger.besu.plugin.data.BlockHeader blockHeader, org.hyperledger.besu.plugin.data.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(org.hyperledger.besu.plugin.data.BlockHeader blockHeader, org.hyperledger.besu.plugin.data.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.