BlockId removal: refactor: Backend::state_at (#12488)

* Minor naming improved

* BlockId removal refactor: Backend::state_at

* formatting
This commit is contained in:
Michal Kucharczyk
2022-10-14 11:27:32 +02:00
committed by GitHub
parent dcd56b1ffd
commit 532dd5ecc2
12 changed files with 105 additions and 100 deletions
@@ -24,7 +24,7 @@ use jsonrpsee::{
};
use sc_rpc_api::DenyUnsafe;
use serde::{Deserialize, Serialize};
use sp_runtime::{generic::BlockId, traits::Block as BlockT};
use sp_runtime::traits::Block as BlockT;
use std::sync::Arc;
use sp_core::{
@@ -144,8 +144,8 @@ where
fn call(&self, at: Option<<B as BlockT>::Hash>) -> RpcResult<MigrationStatusResult> {
self.deny_unsafe.check_if_safe()?;
let block_id = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash));
let state = self.backend.state_at(block_id).map_err(error_into_rpc_err)?;
let hash = at.unwrap_or_else(|| self.client.info().best_hash);
let state = self.backend.state_at(&hash).map_err(error_into_rpc_err)?;
let (top, child) = migration_status(&state).map_err(error_into_rpc_err)?;
Ok(MigrationStatusResult {