fix: return latestValidHash from sidechains (#2725)

This commit is contained in:
Dan Cline
2023-05-18 05:03:51 -04:00
committed by GitHub
parent 20dad4e4fb
commit 65b7702efe

View File

@ -276,12 +276,14 @@ where
return Some(H256::zero())
}
// TODO(mattsse): This could be invoked on new payload which does not make tree canonical,
// which would make this inaccurate, e.g. if an invalid payload is received in this
// scenario: FUC (unknown head) -> valid payload -> invalid payload
// If this is sent from new payload then the parent hash could be in a side chain, and is
// not necessarily canonical
if self.blockchain.header_by_hash(parent_hash).is_some() {
Some(parent_hash)
} else {
self.blockchain.find_canonical_ancestor(parent_hash)
}
}
/// Loads the header for the given `block_number` from the database.
fn load_header(&self, block_number: u64) -> Result<Option<Header>, Error> {