mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
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:
@@ -116,7 +116,7 @@ sp-trie = { version = "3.0.0", default-features = false, path = "../../../primit
|
||||
[dev-dependencies]
|
||||
sc-keystore = { version = "3.0.0", path = "../../../client/keystore" }
|
||||
sc-consensus = { version = "0.9.0", path = "../../../client/consensus/common" }
|
||||
sc-consensus-babe = { version = "0.9.0", features = ["test-helpers"], path = "../../../client/consensus/babe" }
|
||||
sc-consensus-babe = { version = "0.9.0", path = "../../../client/consensus/babe" }
|
||||
sc-consensus-epochs = { version = "0.9.0", path = "../../../client/consensus/epochs" }
|
||||
sc-service-test = { version = "2.0.0", path = "../../../client/service/test" }
|
||||
futures = "0.3.9"
|
||||
|
||||
@@ -638,27 +638,34 @@ mod tests {
|
||||
None,
|
||||
);
|
||||
|
||||
let epoch_descriptor = babe_link.epoch_changes().lock().epoch_descriptor_for_child_of(
|
||||
descendent_query(&*service.client()),
|
||||
&parent_hash,
|
||||
parent_number,
|
||||
slot.into(),
|
||||
).unwrap().unwrap();
|
||||
|
||||
let mut digest = Digest::<H256>::default();
|
||||
|
||||
// even though there's only one authority some slots might be empty,
|
||||
// so we must keep trying the next slots until we can claim one.
|
||||
let babe_pre_digest = loop {
|
||||
inherent_data.replace_data(sp_timestamp::INHERENT_IDENTIFIER, &(slot * SLOT_DURATION));
|
||||
if let Some(babe_pre_digest) = sc_consensus_babe::test_helpers::claim_slot(
|
||||
let (babe_pre_digest, epoch_descriptor) = loop {
|
||||
inherent_data.replace_data(
|
||||
sp_timestamp::INHERENT_IDENTIFIER,
|
||||
&(slot * SLOT_DURATION),
|
||||
);
|
||||
|
||||
let epoch_descriptor = babe_link.epoch_changes().lock().epoch_descriptor_for_child_of(
|
||||
descendent_query(&*service.client()),
|
||||
&parent_hash,
|
||||
parent_number,
|
||||
slot.into(),
|
||||
&parent_header,
|
||||
&*service.client(),
|
||||
keystore.clone(),
|
||||
&babe_link,
|
||||
) {
|
||||
break babe_pre_digest;
|
||||
).unwrap().unwrap();
|
||||
|
||||
let epoch = babe_link.epoch_changes().lock().epoch_data(
|
||||
&epoch_descriptor,
|
||||
|slot| sc_consensus_babe::Epoch::genesis(&babe_link.config(), slot),
|
||||
).unwrap();
|
||||
|
||||
if let Some(babe_pre_digest) = sc_consensus_babe::authorship::claim_slot(
|
||||
slot.into(),
|
||||
&epoch,
|
||||
&keystore,
|
||||
).map(|(digest, _)| digest) {
|
||||
break (babe_pre_digest, epoch_descriptor)
|
||||
}
|
||||
|
||||
slot += 1;
|
||||
|
||||
Reference in New Issue
Block a user