mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 23:57:56 +00:00
grandpa: observer (#2244)
* grandpa: initial implementation of minimal grandpa worker * grandpa: extract grandpa observer future to function * grandpa: add test for observer * grandpa: start observer if no local key is defined * grandpa: add minor comments * grandpa: observer: log invalid commit * grandpa: observer: persist voter set state on authority change and pause * grandpa: observer: use commit processing callback * grandpa: keep run_grandpa to avoid breaking public api * grandpa: use grandpa::process_commit_validation_result * grandpa: use finality-grandpa 0.7.2
This commit is contained in:
committed by
Robert Habermeier
parent
96ef462c46
commit
e31cd26a9e
@@ -110,19 +110,33 @@ construct_service_factory! {
|
||||
local_key
|
||||
};
|
||||
|
||||
executor.spawn(grandpa::run_grandpa(
|
||||
grandpa::Config {
|
||||
local_key,
|
||||
// FIXME #1578 make this available through chainspec
|
||||
gossip_duration: Duration::from_millis(333),
|
||||
justification_period: 4096,
|
||||
name: Some(service.config.name.clone())
|
||||
let config = grandpa::Config {
|
||||
local_key,
|
||||
// FIXME #1578 make this available through chainspec
|
||||
gossip_duration: Duration::from_millis(333),
|
||||
justification_period: 4096,
|
||||
name: Some(service.config.name.clone())
|
||||
};
|
||||
|
||||
match config.local_key {
|
||||
None => {
|
||||
executor.spawn(grandpa::run_grandpa_observer(
|
||||
config,
|
||||
link_half,
|
||||
service.network(),
|
||||
service.on_exit(),
|
||||
)?);
|
||||
},
|
||||
link_half,
|
||||
service.network(),
|
||||
service.config.custom.inherent_data_providers.clone(),
|
||||
service.on_exit(),
|
||||
)?);
|
||||
Some(_) => {
|
||||
executor.spawn(grandpa::run_grandpa_voter(
|
||||
config,
|
||||
link_half,
|
||||
service.network(),
|
||||
service.config.custom.inherent_data_providers.clone(),
|
||||
service.on_exit(),
|
||||
)?);
|
||||
},
|
||||
}
|
||||
|
||||
Ok(service)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user