mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
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:
@@ -36,8 +36,7 @@ use std::sync::Arc;
|
||||
use jsonrpsee::RpcModule;
|
||||
use node_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Index};
|
||||
use sc_client_api::AuxStore;
|
||||
use sc_consensus_babe::{BabeConfiguration, Epoch};
|
||||
use sc_consensus_epochs::SharedEpochChanges;
|
||||
use sc_consensus_babe::BabeWorkerHandle;
|
||||
use sc_consensus_grandpa::{
|
||||
FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState,
|
||||
};
|
||||
@@ -53,10 +52,8 @@ use sp_keystore::KeystorePtr;
|
||||
|
||||
/// Extra dependencies for BABE.
|
||||
pub struct BabeDeps {
|
||||
/// BABE protocol config.
|
||||
pub babe_config: BabeConfiguration,
|
||||
/// BABE pending epoch changes.
|
||||
pub shared_epoch_changes: SharedEpochChanges<Block, Epoch>,
|
||||
/// A handle to the BABE worker for issuing requests.
|
||||
pub babe_worker_handle: BabeWorkerHandle<Block>,
|
||||
/// The keystore that manages the keys of the node.
|
||||
pub keystore: KeystorePtr,
|
||||
}
|
||||
@@ -130,7 +127,7 @@ where
|
||||
let mut io = RpcModule::new(());
|
||||
let FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa } = deps;
|
||||
|
||||
let BabeDeps { keystore, babe_config, shared_epoch_changes } = babe;
|
||||
let BabeDeps { keystore, babe_worker_handle } = babe;
|
||||
let GrandpaDeps {
|
||||
shared_voter_state,
|
||||
shared_authority_set,
|
||||
@@ -151,15 +148,8 @@ where
|
||||
io.merge(Mmr::new(client.clone()).into_rpc())?;
|
||||
io.merge(TransactionPayment::new(client.clone()).into_rpc())?;
|
||||
io.merge(
|
||||
Babe::new(
|
||||
client.clone(),
|
||||
shared_epoch_changes.clone(),
|
||||
keystore,
|
||||
babe_config,
|
||||
select_chain,
|
||||
deny_unsafe,
|
||||
)
|
||||
.into_rpc(),
|
||||
Babe::new(client.clone(), babe_worker_handle.clone(), keystore, select_chain, deny_unsafe)
|
||||
.into_rpc(),
|
||||
)?;
|
||||
io.merge(
|
||||
Grandpa::new(
|
||||
@@ -173,7 +163,7 @@ where
|
||||
)?;
|
||||
|
||||
io.merge(
|
||||
SyncState::new(chain_spec, client.clone(), shared_authority_set, shared_epoch_changes)?
|
||||
SyncState::new(chain_spec, client.clone(), shared_authority_set, babe_worker_handle)?
|
||||
.into_rpc(),
|
||||
)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user