Split PrimaryPreDigest and SecondaryPreDigest (#5373)

* Split PrimaryPreDigest and SecondaryPreDigest

* Update client/consensus/babe/src/lib.rs

Co-Authored-By: André Silva <andre.beat@gmail.com>

* Update primitives/consensus/babe/src/digests.rs

Co-Authored-By: André Silva <andre.beat@gmail.com>

* Update primitives/consensus/babe/src/digests.rs

Co-Authored-By: André Silva <andre.beat@gmail.com>

* Update primitives/consensus/babe/src/digests.rs

Co-Authored-By: André Silva <andre.beat@gmail.com>

Co-authored-by: André Silva <andre.beat@gmail.com>
This commit is contained in:
Wei Tang
2020-03-24 18:07:51 +01:00
committed by GitHub
parent 06525e2b47
commit 2e558908e6
8 changed files with 98 additions and 88 deletions
+3 -8
View File
@@ -209,12 +209,7 @@ impl<T: Trait> FindAuthor<u32> for Module<T> {
for (id, mut data) in digests.into_iter() {
if id == BABE_ENGINE_ID {
let pre_digest: RawPreDigest = RawPreDigest::decode(&mut data).ok()?;
return Some(match pre_digest {
RawPreDigest::Primary { authority_index, .. } =>
authority_index,
RawPreDigest::Secondary { authority_index, .. } =>
authority_index,
});
return Some(pre_digest.authority_index())
}
}
@@ -426,11 +421,11 @@ impl<T: Trait> Module<T> {
CurrentSlot::put(digest.slot_number());
if let RawPreDigest::Primary { vrf_output, .. } = digest {
if let RawPreDigest::Primary(primary) = digest {
// place the VRF output into the `Initialized` storage item
// and it'll be put onto the under-construction randomness
// later, once we've decided which epoch this block is in.
Some(vrf_output)
Some(primary.vrf_output)
} else {
None
}