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:
Wei Tang
2020-07-30 17:07:27 +02:00
committed by GitHub
parent 9ac30f7116
commit b6dedd9016
4 changed files with 92 additions and 10 deletions
@@ -37,6 +37,7 @@ sp-consensus-vrf = { version = "0.8.0-rc5", path = "../../../primitives/consensu
sc-consensus-uncles = { version = "0.8.0-rc5", path = "../uncles" }
sc-consensus-slots = { version = "0.8.0-rc5", path = "../slots" }
sp-runtime = { version = "2.0.0-rc5", path = "../../../primitives/runtime" }
sp-utils = { version = "2.0.0-rc5", path = "../../../primitives/utils" }
fork-tree = { version = "2.0.0-rc5", path = "../../../utils/fork-tree" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0-rc5"}
futures = "0.3.4"
@@ -48,6 +49,7 @@ rand = "0.7.2"
merlin = "2.0"
pdqselect = "0.1.0"
derive_more = "0.99.2"
retain_mut = "0.1.1"
[dev-dependencies]
sp-keyring = { version = "2.0.0-rc5", path = "../../../primitives/keyring" }