mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Support the subscription of every imported block (#13372)
* Support the subscription of every import block Close #13315 * Clean up any closed block import notification sinks * Apply review suggestions * Nit * `every_block_import_notification_sinks` -> `every_import_notification_sinks` * Apply review suggestions
This commit is contained in:
@@ -48,6 +48,19 @@ pub type TransactionForSB<B, Block> = <B as StateBackend<HashFor<Block>>>::Trans
|
||||
/// Extracts the transaction for the given backend.
|
||||
pub type TransactionFor<B, Block> = TransactionForSB<StateBackendFor<B, Block>, Block>;
|
||||
|
||||
/// Describes which block import notification stream should be notified.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum ImportNotificationAction {
|
||||
/// Notify only when the node has synced to the tip or there is a re-org.
|
||||
RecentBlock,
|
||||
/// Notify for every single block no matter what the sync state is.
|
||||
EveryBlock,
|
||||
/// Both block import notifications above should be fired.
|
||||
Both,
|
||||
/// No block import notification should be fired.
|
||||
None,
|
||||
}
|
||||
|
||||
/// Import operation summary.
|
||||
///
|
||||
/// Contains information about the block that just got imported,
|
||||
@@ -67,6 +80,8 @@ pub struct ImportSummary<Block: BlockT> {
|
||||
///
|
||||
/// If `None`, there was no re-org while importing.
|
||||
pub tree_route: Option<sp_blockchain::TreeRoute<Block>>,
|
||||
/// What notify action to take for this import.
|
||||
pub import_notification_action: ImportNotificationAction,
|
||||
}
|
||||
|
||||
/// Finalization operation summary.
|
||||
|
||||
Reference in New Issue
Block a user