find best_containing even if best chain is shorter (#3657)

This commit is contained in:
Robert Habermeier
2019-09-20 18:44:19 +02:00
committed by André Silva
parent e434dbdfc5
commit 68cda2fe79
+3 -3
View File
@@ -1704,10 +1704,10 @@ where
let info = self.backend.blockchain().info();
let canon_hash = self.backend.blockchain().hash(*target_header.number())?
.ok_or_else(|| error::Error::from(format!("failed to get hash for block number {}", target_header.number())))?;
// this can be `None` if the best chain is shorter than the target header.
let maybe_canon_hash = self.backend.blockchain().hash(*target_header.number())?;
if canon_hash == target_hash {
if maybe_canon_hash.as_ref() == Some(&target_hash) {
// if a `max_number` is given we try to fetch the block at the
// given depth, if it doesn't exist or `max_number` is not
// provided, we continue to search from all leaves below.