Interface SynchronizationService
- All Superinterfaces:
BesuService
Synchronization service wraps the sync state and sync event lifecycle.
-
Method Summary
Modifier and TypeMethodDescriptionvoidDisables the worldstate trie for update.voidfireNewUnverifiedForkchoiceEvent(org.hyperledger.besu.datatypes.Hash head, org.hyperledger.besu.datatypes.Hash safeBlock, org.hyperledger.besu.datatypes.Hash finalizedBlock) Enables P2P discovery.Returns the best peer chain head.Returns the current sync status.booleanReturns whether the initial chain and worldstate sync is complete.booleanisInSync()Checks if the node is in sync.booleansetHead(BlockHeader blockHeader, BlockBody blockBody) Set the head of the chain.booleansetHeadUnsafe(BlockHeader blockHeader, BlockBody blockBody) Adds the block header and body to the head of the chain directly, without using a block importer or validation.voidstart()Starts the synchronizer.voidstop()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) Enables P2P discovery.- Parameters:
head- the head of the chain.safeBlock- the safe block.finalizedBlock- the finalized block.
-
setHead
Set the head of the chain.- Parameters:
blockHeader- the block headerblockBody- the block body- Returns:
- true if the head was set, false otherwise.
-
setHeadUnsafe
Adds the block header and body to the head of the chain directly, without using a block importer or validation.- Parameters:
blockHeader- the block headerblockBody- 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
-