Repository: paritytech/substrate
File: client/network/test/src/sync.rs (Rust)

Code before:
			.children_default
			.insert(child1.child_info.storage_key().to_vec(), child1);
		genesis_storage
			.children_default
			.insert(child2.child_info.storage_key().to_vec(), child2);
		genesis_storage
			.children_default
			.insert(child3.child_info.storage_key().to_vec(), child3);
		let mut config_one = FullPeerConfig::default();
		config_one.extra_storage = Some(genesis_storage.clone());
		net.add_full_peer_with_config(config_one);
		let mut config_two = FullPeerConfig::default();
		config_two.extra_storage = Some(genesis_storage);
		config_two.sync_mode =
			SyncMode::Fast { skip_proofs: *skip_proofs, storage_chain_mode: false };
		net.add_full_peer_with_config(config_two);
		net.peer(0).push_blocks(64, false);
		// Wait for peer 1 to sync header chain.
		net.block_until_sync();
		assert!(!net.peer(1).client().has_state_at(&BlockId::Number(64)));

		let just = (*b"FRNK", Vec::new());
		net.peer(1)
			.client()
			.finalize_block(BlockId::Number(60), Some(just), true)
			.unwrap();
		// Wait for state sync.
		block_on(futures::future::poll_fn::<(), _>(|cx| {
			net.poll(cx);
			if net.peer(1).client.info().finalized_state.is_some() {
				Poll::Ready(())
			} else {
				Poll::Pending
			}
		}));
		assert!(!net.peer(1).client().has_state_at(&BlockId::Number(64)));
		// Wait for the rest of the states to be imported.
		block_on(futures::future::poll_fn::<(), _>(|cx| {
			net.poll(cx);
			if net.peer(1).client().has_state_at(&BlockId::Number(64)) {
				Poll::Ready(())
			} else {
				Poll::Pending
			}
		}));
	}
}

#[test]
fn syncs_indexed_blocks() {
	use sp_runtime::traits::Hash;

Review comment (suggestion):
```suggestion
			.peer(1)
```
Nit. For sure in this particular test it doesn't really matter, but just for the sake of formal correctness here I think you want to get the hash by querying `peer(1)`

Code after:
		};
		genesis_storage
			.children_default
			.insert(child1.child_info.storage_key().to_vec(), child1);
		genesis_storage
			.children_default
			.insert(child2.child_info.storage_key().to_vec(), child2);
		genesis_storage
			.children_default
			.insert(child3.child_info.storage_key().to_vec(), child3);
		let mut config_one = FullPeerConfig::default();
		config_one.extra_storage = Some(genesis_storage.clone());
		net.add_full_peer_with_config(config_one);
		let mut config_two = FullPeerConfig::default();
		config_two.extra_storage = Some(genesis_storage);
		config_two.sync_mode =
			SyncMode::Fast { skip_proofs: *skip_proofs, storage_chain_mode: false };
		net.add_full_peer_with_config(config_two);
		net.peer(0).push_blocks(64, false);
		// Wait for peer 1 to sync header chain.
		net.block_until_sync();
		assert!(!net.peer(1).client().has_state_at(&BlockId::Number(64)));

		let just = (*b"FRNK", Vec::new());
		let hashof60 = net
			.peer(0)
			.client()
			.as_backend()
			.blockchain()
			.expect_block_hash_from_id(&BlockId::Number(60))
			.unwrap();
		net.peer(1).client().finalize_block(&hashof60, Some(just), true).unwrap();
		// Wait for state sync.
		block_on(futures::future::poll_fn::<(), _>(|cx| {
			net.poll(cx);
			if net.peer(1).client.info().finalized_state.is_some() {
				Poll::Ready(())
			} else {
				Poll::Pending
			}
		}));
		assert!(!net.peer(1).client().has_state_at(&BlockId::Number(64)));
		// Wait for the rest of the states to be imported.
		block_on(futures::future::poll_fn::<(), _>(|cx| {
			net.poll(cx);
			if net.peer(1).client().has_state_at(&BlockId::Number(64)) {
				Poll::Ready(())
			} else {
				Poll::Pending
			}
		}));