message: Streamline the block version checking
diff: @@ -751,16 +751,9 @@ where
  item.header(),
  ctx.config.protocol_version(),
  )?;
  - // TODO[RC]: The `if` below is actually another flavor of `check_block_version()`...
  - if item.header().protocol_version() < parent_header.protocol_version() {
  - return Err(Error::LowerVersionThanParent {
  - parent: Box::new(parent_header.clone()),
  - child: Box::new(item.header().clone()),
  - });
  - } else {
  + check_block_version_is_not_lower_than_parent(item.header(), parent_header)?;
  return Ok(Some(item));
  }
  - }
  None => {
  if peer_count >= minimum_peer_count_threshold {
  warn!(
  @@ -774,7 +767,7 @@ where
  info!(
  %height,
  %peer_count,
  - %minimum_peer_count_threshold, "did not have enough peers"
  + %minimum_peer_count_threshold, "tried fetching with not enough peers, may try again"
  );
  }
  }
  @@ -912,6 +905,22 @@ fn check_block_version_is_not_greater_than_current(
  Ok(())
  }
  +/// Compares the block's version with the parent block version and returns an error if it is
  +/// too old.
  +fn check_block_version_is_not_lower_than_parent(
  + header: &BlockHeader,
  + parent_header: &BlockHeader,
  +) -> Result<(), Error> {
  + if header.protocol_version() < parent_header.protocol_version() {
  + return Err(Error::LowerVersionThanParent {
  + parent: Box::new(parent_header.clone()),
  + child: Box::new(header.clone()),
  + });
  + }
  +
  + Ok(())
  +}
  +
  /// Queries all of the peers for a trie, puts the trie found from the network in the trie-store, and
  /// returns any outstanding descendant tries.
  async fn fetch_and_store_trie<REv>(
  