Replace unreachable expect with tidier solution (#1278)

This commit is contained in:
Paul Hauner 2020-06-23 12:08:52 +10:00 committed by GitHub
parent 710409c2ba
commit 6d507ef863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1225,14 +1225,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
}
}
while !filtered_chain_segment.is_empty() {
while let Some((_root, block)) = filtered_chain_segment.first() {
// Determine the epoch of the first block in the remaining segment.
let start_epoch = filtered_chain_segment
.first()
.map(|(_root, block)| block)
.expect("chain_segment cannot be empty")
.slot()
.epoch(T::EthSpec::slots_per_epoch());
let start_epoch = block.slot().epoch(T::EthSpec::slots_per_epoch());
// The `last_index` indicates the position of the last block that is in the current
// epoch of `start_epoch`.