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:
Liu-Cheng Xu
2023-02-27 17:02:54 +08:00
committed by GitHub
parent 16773d3696
commit 1d5ea509d0
4 changed files with 120 additions and 31 deletions
+8 -2
View File
@@ -59,10 +59,16 @@ pub trait BlockOf {
/// A source of blockchain events.
pub trait BlockchainEvents<Block: BlockT> {
/// Get block import event stream. Not guaranteed to be fired for every
/// imported block.
/// Get block import event stream.
///
/// Not guaranteed to be fired for every imported block, only fired when the node
/// has synced to the tip or there is a re-org. Use `every_import_notification_stream()`
/// if you want a notification of every imported block regardless.
fn import_notification_stream(&self) -> ImportNotifications<Block>;
/// Get a stream of every imported block.
fn every_import_notification_stream(&self) -> ImportNotifications<Block>;
/// Get a stream of finality notifications. Not guaranteed to be fired for every
/// finalized block.
fn finality_notification_stream(&self) -> FinalityNotifications<Block>;