Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Replace DB assertion with error (#9362)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
arkpar and cheme authored Jul 16, 2021
1 parent 254bc43 commit b47244c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down

0 comments on commit b47244c

Please sign in to comment.