babe: replace usage of SharedEpochChanges with internal RPC (#13883)

* babe: replace usage of SharedEpochChanges with internal RPC

* babe-rpc: fix tests

* babe: use SinkExt::send instead of Sender::try_send

SinkExt::send provides backpressure in case the channel is full

* Update client/consensus/babe/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* babe: fix spawn

* babe: send handles backpressure

* babe: use testing::TaskExecutor

* babe-rpc: better error handling

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
André Silva
2023-04-18 10:38:04 +01:00
committed by GitHub
parent 818976d98e
commit e8e22b83b8
7 changed files with 172 additions and 176 deletions
+3 -7
View File
@@ -203,7 +203,7 @@ pub fn new_partial(
)?;
let slot_duration = babe_link.config().slot_duration();
let import_queue = sc_consensus_babe::import_queue(
let (import_queue, babe_worker_handle) = sc_consensus_babe::import_queue(
babe_link.clone(),
block_import.clone(),
Some(Box::new(justification_import)),
@@ -228,7 +228,7 @@ pub fn new_partial(
let import_setup = (block_import, grandpa_link, babe_link);
let (rpc_extensions_builder, rpc_setup) = {
let (_, grandpa_link, babe_link) = &import_setup;
let (_, grandpa_link, _) = &import_setup;
let justification_stream = grandpa_link.justification_stream();
let shared_authority_set = grandpa_link.shared_authority_set().clone();
@@ -240,9 +240,6 @@ pub fn new_partial(
Some(shared_authority_set.clone()),
);
let babe_config = babe_link.config().clone();
let shared_epoch_changes = babe_link.epoch_changes().clone();
let client = client.clone();
let pool = transaction_pool.clone();
let select_chain = select_chain.clone();
@@ -258,9 +255,8 @@ pub fn new_partial(
chain_spec: chain_spec.cloned_box(),
deny_unsafe,
babe: node_rpc::BabeDeps {
babe_config: babe_config.clone(),
shared_epoch_changes: shared_epoch_changes.clone(),
keystore: keystore.clone(),
babe_worker_handle: babe_worker_handle.clone(),
},
grandpa: node_rpc::GrandpaDeps {
shared_voter_state: shared_voter_state.clone(),