mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix: return latestValidHash from sidechains (#2725)
This commit is contained in:
@ -276,12 +276,14 @@ 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)
|
||||||
|
} else {
|
||||||
self.blockchain.find_canonical_ancestor(parent_hash)
|
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.
|
||||||
fn load_header(&self, block_number: u64) -> Result<Option<Header>, Error> {
|
fn load_header(&self, block_number: u64) -> Result<Option<Header>, Error> {
|
||||||
|
|||||||
Reference in New Issue
Block a user