message: Use storage integrity check code from dev.
diff: @@ -450,7 +450,6 @@ impl Storage {
  let mut deleted_block_hashes = HashSet::new();
  let mut deleted_block_body_hashes_v1 = HashSet::new();
  - let mut any_v2_block_deleted = false;
  // Note: `iter_start` has an undocumented panic if called on an empty database. We rely on
  // the iterator being at the start when created.
  for (raw_key, raw_val) in cursor.iter() {
  @@ -462,14 +461,9 @@ impl Storage {
  if block_header.era_id() >= invalid_era
  && block_header.protocol_version() < protocol_version
  {
  - match block_header.hashing_algorithm_version() {
  - HashingAlgorithmVersion::V1 => {
  + if block_header.hashing_algorithm_version() == HashingAlgorithmVersion::V1 {
  let _ = deleted_block_body_hashes_v1.insert(*block_header.body_hash());
  }
  - HashingAlgorithmVersion::V2 => {
  - any_v2_block_deleted = true;
  - }
  - }
  let _ = deleted_block_hashes.insert(block_header.hash());
  cursor.del(WriteFlags::empty())?;
  continue;
  @@ -544,7 +538,6 @@ impl Storage {
  &deploy_hashes_db,
  &transfer_hashes_db,
  &proposer_db,
  - any_v2_block_deleted,
  should_check_integrity,
  )?;
  initialize_block_metadata_db(
  @@ -2006,20 +1999,16 @@ fn initialize_block_body_v2_db(
  deploy_hashes_db: &Database,
  transfer_hashes_db: &Database,
  proposer_db: &Database,
  - any_v2_block_deleted: bool,
  should_check_integrity: bool,
  ) -> Result<(), Error> {
  info!("initializing v2 block body database");
  + if should_check_integrity {
  let txn = env.begin_rw_txn()?;
  - let block_body_hash_to_header_map = if any_v2_block_deleted || should_check_integrity {
  - construct_block_body_to_block_header_reverse_lookup(&txn, block_header_db)?
  - } else {
  - BTreeMap::new()
  - };
  + let block_body_hash_to_header_map =
  + construct_block_body_to_block_header_reverse_lookup(&txn, block_header_db)?;
  - if should_check_integrity {
  let expected_hashing_algorithm_version = HashingAlgorithmVersion::V2;
  for (raw_key, _raw_val) in txn.open_ro_cursor(*block_body_v2_db)?.iter() {
  let block_body_hash = Digest::try_from(raw_key)
  @@ -2064,9 +2053,8 @@ fn initialize_block_body_v2_db(
  };
  txn2.commit()?;
  }
  - }
  -
  txn.commit()?;
  + }
  info!("v2 block body database initialized");
  Ok(())
  