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

Fix missing block number issue on forced canonicalization #12949

Merged
merged 5 commits into from
Dec 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Review comments
  • Loading branch information
bkchr committed Dec 16, 2022
commit 71b87a6b0f7327723c965c53e16d5bc8ece6c927
6 changes: 3 additions & 3 deletions client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,6 @@ impl<Block: BlockT> Backend<Block> {
let best_canonical = || self.storage.state_db.best_canonical().unwrap_or(0);
let info = self.blockchain.info();
let best_number: u64 = self.blockchain.info().best_number.saturated_into();
let best_hash = info.best_hash;

while best_number.saturating_sub(best_canonical()) > self.canonicalization_delay {
let to_canonicalize = best_canonical() + 1;
Expand All @@ -1329,9 +1328,10 @@ impl<Block: BlockT> Backend<Block> {
to_canonicalize.saturated_into(),
)?
.ok_or_else(|| {
let best_hash = info.best_hash;

sp_blockchain::Error::Backend(format!(
"Can't canonicalize missing block number #{} when for best block {:?} (#{})",
to_canonicalize, best_hash, best_number,
"Can't canonicalize missing block number #{to_canonicalize} when for best block {best_hash:?} (#{best_number})",
))
})?;

Expand Down