Deduplicate Grandpa consensus log reading logic (#2245) (#2246)

This commit is contained in:
Serban Iorga
2023-07-07 13:26:55 +03:00
committed by Bastian Köcher
parent d327c9e0a8
commit fc0aa382ab
3 changed files with 29 additions and 47 deletions
@@ -237,10 +237,9 @@ impl<C: ChainWithGrandpa> Engine<C> for Grandpa<C> {
// If initial header changes the GRANDPA authorities set, then we need previous authorities
// to verify justification.
let mut authorities_for_verification = initial_authorities_set.clone();
let scheduled_change =
GrandpaConsensusLogReader::<BlockNumberOf<C>>::find_authorities_change(
initial_header.digest(),
);
let scheduled_change = GrandpaConsensusLogReader::<BlockNumberOf<C>>::find_scheduled_change(
initial_header.digest(),
);
assert!(
scheduled_change.as_ref().map(|c| c.delay.is_zero()).unwrap_or(true),
"GRANDPA authorities change at {} scheduled to happen in {:?} blocks. We expect\