Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
babe: minor rpc nits (#5974)
Browse files Browse the repository at this point in the history
* babe: fix formatting

* babe: re-use same epoch data in epoch_authorship rpc method
  • Loading branch information
andresilva authored May 12, 2020
1 parent 9d09d37 commit d2b38b6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions client/consensus/babe/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,18 @@ impl<B, C, SC> BabeApi for BabeRPCHandler<B, C, SC>

let key_pairs = {
let keystore = keystore.read();
epoch.authorities.iter().enumerate()
.flat_map(|(i, a)| {
keystore.key_pair::<sp_consensus_babe::AuthorityPair>(&a.0).ok().map(|kp| (kp, i))
})
.collect::<Vec<_>>()
epoch.authorities.iter()
.enumerate()
.flat_map(|(i, a)| {
keystore
.key_pair::<sp_consensus_babe::AuthorityPair>(&a.0)
.ok()
.map(|kp| (kp, i))
})
.collect::<Vec<_>>()
};

for slot_number in epoch_start..epoch_end {
let epoch = epoch_data(&shared_epoch, &client, &babe_config, slot_number, &select_chain)?;
if let Some((claim, key)) =
authorship::claim_slot_using_key_pairs(slot_number, &epoch, &key_pairs)
{
Expand Down

0 comments on commit d2b38b6

Please sign in to comment.