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
@@ -716,12 +716,18 @@ where
HasVoted::No => HasVoted::No,
};
// we can only sign when we have a local key in the authority set
// and we have a reference to the keystore.
let keystore = match (local_key.as_ref(), self.config.keystore.as_ref()) {
(Some(id), Some(keystore)) => Some((id.clone(), keystore.clone()).into()),
_ => None,
};
let (incoming, outgoing) = self.network.round_communication(
self.config.keystore.clone(),
keystore,
crate::communication::Round(round),
crate::communication::SetId(self.set_id),
self.voters.clone(),
local_key.clone(),
has_voted,
);