Get rid of test-helpers feature in sc-consensus-babe (#8486)

This is not really required and having a special `test-helpers` feature
is a bad idea anyway.
This commit is contained in:
Bastian Köcher
2021-03-30 08:10:54 +02:00
committed by GitHub
parent fb73a4eef6
commit 2998b42311
4 changed files with 24 additions and 58 deletions
@@ -1647,41 +1647,3 @@ pub fn import_queue<Block: BlockT, Client, SelectChain, Inner, CAW>(
registry,
))
}
/// BABE test helpers. Utility methods for manually authoring blocks.
#[cfg(feature = "test-helpers")]
pub mod test_helpers {
use super::*;
/// Try to claim the given slot and return a `BabePreDigest` if
/// successful.
pub fn claim_slot<B, C>(
slot: Slot,
parent: &B::Header,
client: &C,
keystore: SyncCryptoStorePtr,
link: &BabeLink<B>,
) -> Option<PreDigest> where
B: BlockT,
C: ProvideRuntimeApi<B> +
ProvideCache<B> +
HeaderBackend<B> +
HeaderMetadata<B, Error = ClientError>,
C::Api: BabeApi<B>,
{
let epoch_changes = link.epoch_changes.lock();
let epoch = epoch_changes.epoch_data_for_child_of(
descendent_query(client),
&parent.hash(),
parent.number().clone(),
slot,
|slot| Epoch::genesis(&link.config, slot),
).unwrap().unwrap();
authorship::claim_slot(
slot,
&epoch,
&keystore,
).map(|(digest, _)| digest)
}
}