grandpa: minor cleanups in communication module (#6371)

* grandpa: replace Result<(), ()> with Option<()>

* grandpa: replace &Option<T> with Option<&T>

* grandpa: cleanup local id and keystore usages

* grandpa: return bool on check_message_signature

* grandpa: fix erroneous log message on startup

* grandpa: fix test
This commit is contained in:
André Silva
2020-06-30 18:59:36 +01:00
committed by GitHub
parent 53be6ec510
commit 4cf1b4fa7b
9 changed files with 79 additions and 51 deletions
+3 -3
View File
@@ -593,7 +593,7 @@ fn global_communication<BE, Block: BlockT, C, N>(
voters: &Arc<VoterSet<AuthorityId>>,
client: Arc<C>,
network: &NetworkBridge<Block, N>,
keystore: &Option<BareCryptoStorePtr>,
keystore: Option<&BareCryptoStorePtr>,
metrics: Option<until_imported::Metrics>,
) -> (
impl Stream<
@@ -609,7 +609,7 @@ fn global_communication<BE, Block: BlockT, C, N>(
N: NetworkT<Block>,
NumberFor<Block>: BlockNumberOps,
{
let is_voter = is_voter(voters, keystore.as_ref()).is_some();
let is_voter = is_voter(voters, keystore).is_some();
// verification stream
let (global_in, global_out) = network.global_communication(
@@ -907,7 +907,7 @@ where
&self.env.voters,
self.env.client.clone(),
&self.env.network,
&self.env.config.keystore,
self.env.config.keystore.as_ref(),
self.metrics.as_ref().map(|m| m.until_imported.clone()),
);