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