Replace DB assertion with error (#9362)

* Replace DB assert with error

* Update client/db/src/lib.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
This commit is contained in:
Arkadiy Paronyan
2021-07-16 18:45:26 +02:00
committed by GitHub
parent 3ce2bd3eec
commit f07a41e87d
+6 -2
View File
@@ -1306,8 +1306,12 @@ impl<Block: BlockT> Backend<Block> {
sc_client_api::blockchain::HeaderBackend::hash(
&self.blockchain,
new_canonical.saturated_into(),
)?.expect("existence of block with number `new_canonical` \
implies existence of blocks with all numbers before it; qed")
)?.ok_or_else(|| sp_blockchain::Error::Backend(format!(
"Can't canonicalize missing block number #{} when importing {:?} (#{})",
new_canonical,
hash,
number,
)))?
};
if !sc_client_api::Backend::have_state_at(self, &hash, new_canonical.saturated_into()) {
return Ok(())