perf: use final paris difficulty if configured (#2969)

This commit is contained in:
Matthias Seitz
2023-06-05 04:47:28 +02:00
committed by GitHub
parent c81b059e96
commit f042548689

View File

@ -94,6 +94,12 @@ impl<'this, TX: DbTx<'this>> HeaderProvider for DatabaseProvider<'this, TX> {
}
fn header_td_by_number(&self, number: BlockNumber) -> Result<Option<U256>> {
if let Some(td) = self.chain_spec.final_paris_difficulty(number) {
// if this block is higher than the final paris(merge) block, return the final paris
// difficulty
return Ok(Some(td))
}
Ok(self.tx.get::<tables::HeaderTD>(number)?.map(|td| td.0))
}