From d2b38b6880e4d5f5689cca3961adfa19c1a18d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Tue, 12 May 2020 14:18:15 +0100 Subject: [PATCH] babe: minor rpc nits (#5974) * babe: fix formatting * babe: re-use same epoch data in epoch_authorship rpc method --- client/consensus/babe/rpc/src/lib.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/client/consensus/babe/rpc/src/lib.rs b/client/consensus/babe/rpc/src/lib.rs index aa7e1c0e1e21c..44273a285949f 100644 --- a/client/consensus/babe/rpc/src/lib.rs +++ b/client/consensus/babe/rpc/src/lib.rs @@ -118,15 +118,18 @@ impl BabeApi for BabeRPCHandler let key_pairs = { let keystore = keystore.read(); - epoch.authorities.iter().enumerate() - .flat_map(|(i, a)| { - keystore.key_pair::(&a.0).ok().map(|kp| (kp, i)) - }) - .collect::>() + epoch.authorities.iter() + .enumerate() + .flat_map(|(i, a)| { + keystore + .key_pair::(&a.0) + .ok() + .map(|kp| (kp, i)) + }) + .collect::>() }; 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) {