Make sure GRANDPA shares state with RPC. (#987)

* Make sure GRANDPA shares state with RPC.

* RPC shared state with GRANDPA rialto.

* fmt

* cargo fix

* fix clippy
This commit is contained in:
Roman Useinov
2021-06-08 10:55:55 +02:00
committed by Bastian Köcher
parent a6379d2968
commit cab4c7cd05
2 changed files with 9 additions and 6 deletions
+5 -3
View File
@@ -35,7 +35,7 @@ use sc_client_api::{ExecutorProvider, RemoteBackend};
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
use sc_executor::native_executor_instance;
pub use sc_executor::NativeExecutor;
use sc_finality_grandpa::SharedVoterState;
use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker};
@@ -209,6 +209,8 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
let enable_grandpa = !config.disable_grandpa;
let prometheus_registry = config.prometheus_registry().cloned();
let shared_voter_state = sc_finality_grandpa::SharedVoterState::empty();
let rpc_extensions_builder = {
use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
@@ -223,7 +225,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
let justification_stream = grandpa_link.justification_stream();
let shared_authority_set = grandpa_link.shared_authority_set().clone();
let shared_voter_state = sc_finality_grandpa::SharedVoterState::empty();
let shared_voter_state = shared_voter_state.clone();
let finality_proof_provider =
GrandpaFinalityProofProvider::new_for_service(backend, Some(shared_authority_set.clone()));
@@ -342,7 +344,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
network,
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry,
shared_voter_state: SharedVoterState::empty(),
shared_voter_state,
telemetry: telemetry.as_ref().map(|x| x.handle()),
};