feat: support time-based forking (#1128)

This commit is contained in:
Bjerg
2023-02-06 21:55:41 +01:00
committed by GitHub
parent 3605e00428
commit 02a6aec3fb
38 changed files with 1204 additions and 28330 deletions

View File

@ -4,7 +4,7 @@ use reth_db::{
transaction::{DbTx, DbTxMut},
};
use reth_interfaces::{provider::Error as ProviderError, Result};
use reth_primitives::SealedBlock;
use reth_primitives::{SealedBlock, U256};
/// Insert block data into corresponding tables. Used mainly for testing & internal tooling.
///
@ -24,6 +24,11 @@ pub fn insert_block<'a, TX: DbTxMut<'a> + DbTx<'a>>(
// Put header with canonical hashes.
tx.put::<tables::Headers>(block_num_hash, block.header.as_ref().clone())?;
tx.put::<tables::HeaderNumbers>(block.hash(), block.number)?;
tx.put::<tables::HeaderTD>(
block_num_hash,
if has_block_reward { U256::ZERO } else { U256::from(58_750_000_000_000_000_000_000u128) }
.into(),
)?;
// insert body ommers data
tx.put::<tables::BlockOmmers>(