grandpa: reduce allocations when verifying multiple messages (#4693)

This commit is contained in:
André Silva
2020-01-21 11:45:36 +00:00
committed by GitHub
parent 85aa632278
commit b7a63e3b77
2 changed files with 62 additions and 8 deletions
@@ -132,14 +132,16 @@ impl<Block: BlockT> GrandpaJustification<Block> {
}
}
let mut buf = Vec::new();
let mut visited_hashes = HashSet::new();
for signed in self.commit.precommits.iter() {
if let Err(_) = communication::check_message_sig::<Block>(
if let Err(_) = communication::check_message_sig_with_buffer::<Block>(
&finality_grandpa::Message::Precommit(signed.precommit.clone()),
&signed.id,
&signed.signature,
self.round,
set_id,
&mut buf,
) {
return Err(ClientError::BadJustification(
"invalid signature for precommit in grandpa justification".to_string()).into());