Interface BesuEvents
- All Superinterfaces:
BesuService
This service allows plugins to attach to various events during the normal operation of Besu.
Currently supported events
- BlockAdded - Fired when a new block has been evaluated and validated.
- BlockReorg - Fired when a block is removed from the chain to change to a different chainhead.
- BlockPropagated - Fired when a new block header has been received and validated and is about to be sent out to other peers, but before the body of the block has been evaluated and validated.
- TransactionAdded - Fired when a new transaction has been added to the node.
- TransactionDropped - Fired when a new transaction has been dropped from the node.
- Logs - Fired when a new block containing logs is received.
- SynchronizerStatus - Fired when the status of the synchronizer changes.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe interface defining bad block listenersstatic interfaceThe listener interface for receiving new block added events.static interfaceThe listener interface for receiving new block propagated events.static interfaceThe listener interface for receiving new block reorg events.static interfaceThe interface Initial sync completion listener.static interfaceThe listener interface for receiving log events.static interfaceThe listener interface for receiving sync status events.static interfaceThe listener interface for receiving new transaction added events.static interfaceThe listener interface for receiving transaction dropped events.static interfaceThe interface TTD reached listener. -
Method Summary
Modifier and TypeMethodDescriptionlongAdd listener to track bad blocks.longaddBlockAddedListener(BesuEvents.BlockAddedListener blockAddedListener) Add a listener watching for new blocks added.longaddBlockPropagatedListener(BesuEvents.BlockPropagatedListener blockPropagatedListener) Add a listener watching new blocks propagated.longaddBlockReorgListener(BesuEvents.BlockReorgListener blockReorgListener) Add a listener watching for new reorg blocks added.longAdd an initial sync completion listener.longaddLogListener(List<org.hyperledger.besu.datatypes.Address> addresses, List<List<org.apache.tuweni.bytes.Bytes32>> topics, BesuEvents.LogListener logListener) Add a listener that consumes every log (both added and removed) that matches the filter parameters when a new block is added to the blockchain.longaddSyncStatusListener(BesuEvents.SyncStatusListener syncStatusListener) Add a listener watching the synchronizer status.longaddTransactionAddedListener(BesuEvents.TransactionAddedListener transactionAddedListener) Add a listener watching new transactions added to the node.longaddTransactionDroppedListener(BesuEvents.TransactionDroppedListener transactionDroppedListener) Add a listener watching dropped transactions.voidremoveBadBlockListener(long listenerIdentifier) Remove the bad block listener with the associated id.voidremoveBlockAddedListener(long listenerIdentifier) Remove the block added listener from besu notifications.voidremoveBlockPropagatedListener(long listenerIdentifier) Remove the blockAdded listener from besu notifications.voidremoveBlockReorgListener(long listenerIdentifier) Remove the block reorg listener from besu notifications.voidremoveLogListener(long listenerIdentifier) Remove the log listener with the associated id.voidremoveSyncStatusListener(long listenerIdentifier) Remove the sync status listener from besu notifications.voidremoveTransactionAddedListener(long listenerIdentifier) Remove the blockAdded listener from besu notifications.voidremoveTransactionDroppedListener(long listenerIdentifier) Remove the transactionDropped listener from besu notifications.
-
Method Details
-
addBlockPropagatedListener
Add a listener watching new blocks propagated.- Parameters:
blockPropagatedListener- The listener that will accept a BlockHeader as the event.- Returns:
- an id to be used as an identifier when de-registering the event.
-
removeBlockPropagatedListener
void removeBlockPropagatedListener(long listenerIdentifier) Remove the blockAdded listener from besu notifications.- Parameters:
listenerIdentifier- The id that was returned from addBlockPropagatedListener
-
addBlockAddedListener
Add a listener watching for new blocks added.- Parameters:
blockAddedListener- The listener that will accept the Block object as the event.- Returns:
- an id to be used as an identifier when de-registering the event.
-
removeBlockAddedListener
void removeBlockAddedListener(long listenerIdentifier) Remove the block added listener from besu notifications.- Parameters:
listenerIdentifier- The id that was returned from addBlockAddedListener
-
addBlockReorgListener
Add a listener watching for new reorg blocks added.- Parameters:
blockReorgListener- The listener that will accept the reorg Block object as the event.- Returns:
- an id to be used as an identifier when de-registering the event.
-
removeBlockReorgListener
void removeBlockReorgListener(long listenerIdentifier) Remove the block reorg listener from besu notifications.- Parameters:
listenerIdentifier- The id that was returned from addBlockReorgListener
-
addInitialSyncCompletionListener
Add an initial sync completion listener.- Parameters:
listener- to subscribe to initial sync completion events- Returns:
- id of listener subscription
-
addTransactionAddedListener
Add a listener watching new transactions added to the node.- Parameters:
transactionAddedListener- The listener that will accept the Transaction object as the event.- Returns:
- an id to be used as an identifier when de-registering the event.
-
removeTransactionAddedListener
void removeTransactionAddedListener(long listenerIdentifier) Remove the blockAdded listener from besu notifications.- Parameters:
listenerIdentifier- The id that was returned from addTransactionAddedListener
-
addTransactionDroppedListener
long addTransactionDroppedListener(BesuEvents.TransactionDroppedListener transactionDroppedListener) Add a listener watching dropped transactions.- Parameters:
transactionDroppedListener- The listener that will accept the Transaction object as the event.- Returns:
- an id to be used as an identifier when de-registering the event.
-
removeTransactionDroppedListener
void removeTransactionDroppedListener(long listenerIdentifier) Remove the transactionDropped listener from besu notifications.- Parameters:
listenerIdentifier- The id that was returned from addTransactionDroppedListener
-
addSyncStatusListener
Add a listener watching the synchronizer status.- Parameters:
syncStatusListener- The listener that will accept the SyncStatus object as the event.- Returns:
- The id to be used as an identifier when de-registering the event.
-
removeSyncStatusListener
void removeSyncStatusListener(long listenerIdentifier) Remove the sync status listener from besu notifications.- Parameters:
listenerIdentifier- The id that was returned from addSyncStatusListener
-
addLogListener
long addLogListener(List<org.hyperledger.besu.datatypes.Address> addresses, List<List<org.apache.tuweni.bytes.Bytes32>> topics, BesuEvents.LogListener logListener) Add a listener that consumes every log (both added and removed) that matches the filter parameters when a new block is added to the blockchain.- Parameters:
addresses- The addresses from which the log filter will be createdtopics- The topics from which the log filter will be createdlogListener- The listener that will accept the log.- Returns:
- The id of the listener to be used to remove the listener.
-
removeLogListener
void removeLogListener(long listenerIdentifier) Remove the log listener with the associated id.- Parameters:
listenerIdentifier- The id of the listener that was returned from addLogListener
-
addBadBlockListener
Add listener to track bad blocks. These are intrinsically bad blocks that have failed validation or descend from a bad block that has failed validation.- Parameters:
listener- The listener that will receive bad block events.- Returns:
- The id of the listener to be used to remove the listener.
-
removeBadBlockListener
void removeBadBlockListener(long listenerIdentifier) Remove the bad block listener with the associated id.- Parameters:
listenerIdentifier- The id of the listener that was returned from addBadBlockListener.
-