fix(node): insert genesis on node startup (#909)

This commit is contained in:
Roman Krasiuk
2023-01-17 23:34:24 +02:00
committed by GitHub
parent 075493ea5e
commit 74fb28932f
2 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,7 @@ use clap::{crate_version, Parser};
use eyre::Context;
use fdlimit::raise_fd_limit;
use futures::{stream::select as stream_select, Stream, StreamExt};
use reth_cli_utils::init::init_genesis;
use reth_consensus::BeaconConsensus;
use reth_downloaders::{bodies, headers};
use reth_interfaces::consensus::ForkchoiceState;
@ -114,6 +115,9 @@ impl Command {
HeaderMetrics::describe();
}
let genesis = init_genesis(db.clone(), self.chain.genesis().clone())?;
info!(target: "reth::cli", ?genesis, "Inserted genesis");
let consensus: Arc<BeaconConsensus> = Arc::new(BeaconConsensus::new(self.chain.clone()));
let network = config

View File

@ -81,6 +81,11 @@ impl ChainSpec {
self.chain
}
/// Return genesis block
pub fn genesis(&self) -> &Genesis {
&self.genesis
}
/// Returns the chain genesis hash
pub fn genesis_hash(&self) -> H256 {
self.genesis_hash