Skip to content

Commit

Permalink
error when resolving version and no wasm in storage.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheme committed Oct 20, 2021
1 parent c342bdf commit d8a9b50
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions client/service/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ where
storage: &Storage,
executor: &E,
) -> sp_blockchain::Result<StateVersion> {
Ok(if let Some(wasm) = storage.top.get(well_known_keys::CODE) {
if let Some(wasm) = storage.top.get(well_known_keys::CODE) {
let mut ext = sp_state_machine::BasicExternalities::new_empty(); // just to read runtime version.
let code_fetcher = crate::client::wasm_override::WasmBlob::new(wasm.clone());
let hash = code_fetcher.hash.clone();
Expand All @@ -1290,10 +1290,12 @@ where
let runtime_version =
RuntimeVersionOf::runtime_version(executor, &mut ext, &runtime_code)
.map_err(|e| sp_blockchain::Error::VersionInvalid(format!("{:?}", e)))?;
runtime_version.state_version()
Ok(runtime_version.state_version())
} else {
Default::default()
})
Err(sp_blockchain::Error::VersionInvalid(
"Could not fetch runtime from storage.".to_string(),
))
}
}
}

Expand Down

0 comments on commit d8a9b50

Please sign in to comment.