mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 03:27:58 +00:00
BABE slot and epoch event notifications (#6563)
* BabeWorker -> BabeSlotWorker * SlotWorker::notify_slot: similar to claim_slot, but called no matter authoring * Wrap the future with a new struct BabeWorker * Add type definition slot_notification_sinks * Function slot_notification_streams for the receiver side * Get a handle of slot_notification_sinks in BabeSlotWorker * Implement notify_slot * Switch to use bounded mpsc * Do not drop the sink when channel is full Only skip sending the message and emit a warning, because it is recoverable. * Fix future type bounds * Add must_use and sink type alias
This commit is contained in:
@@ -104,6 +104,15 @@ pub trait SimpleSlotWorker<B: BlockT> {
|
||||
epoch_data: &Self::EpochData,
|
||||
) -> Option<Self::Claim>;
|
||||
|
||||
/// Notifies the given slot. Similar to `claim_slot`, but will be called no matter whether we
|
||||
/// need to author blocks or not.
|
||||
fn notify_slot(
|
||||
&self,
|
||||
_header: &B::Header,
|
||||
_slot_number: u64,
|
||||
_epoch_data: &Self::EpochData,
|
||||
) { }
|
||||
|
||||
/// Return the pre digest data to include in a block authored with the given claim.
|
||||
fn pre_digest_data(
|
||||
&self,
|
||||
@@ -191,6 +200,8 @@ pub trait SimpleSlotWorker<B: BlockT> {
|
||||
}
|
||||
};
|
||||
|
||||
self.notify_slot(&chain_head, slot_number, &epoch_data);
|
||||
|
||||
let authorities_len = self.authorities_len(&epoch_data);
|
||||
|
||||
if !self.force_authoring() &&
|
||||
|
||||
Reference in New Issue
Block a user