chore: check genesis mismatch in init_genesis (#1560)

This commit is contained in:
Tom French
2023-02-27 13:08:20 +00:00
committed by GitHub
parent 2d0699e98a
commit 7275f8d922
3 changed files with 47 additions and 20 deletions

View File

@ -49,16 +49,7 @@ impl InitCommand {
info!(target: "reth::cli", "Database opened");
info!(target: "reth::cli", "Writing genesis block");
let genesis_hash = init_genesis(db, self.chain.clone())?;
if genesis_hash != self.chain.genesis_hash() {
// TODO: better error text
return Err(eyre::eyre!(
"Genesis hash mismatch: expected {}, got {}",
self.chain.genesis_hash(),
genesis_hash
))
}
init_genesis(db, self.chain.clone())?;
Ok(())
}