Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Insert genesis details into extras database
Browse files Browse the repository at this point in the history
Also insert the genesis block details into the extras database during
rebuild since the genesis block won't be reimported during the rebuild
process.
  • Loading branch information
halfalicious committed Nov 15, 2019
1 parent e725be6 commit f8b1362
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libethereum/BlockChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,12 @@ void BlockChain::rebuild(fs::path const& _path, std::function<void(unsigned, uns
(db::Slice)dev::ref(m_details[m_lastBlockHash].rlp()));

// Manually insert the genesis block details so that they're available during import of the
// first block
m_details[m_genesisHash] = BlockDetails{0, s.info().difficulty(), h256(), {}};
// first block.
auto const genesisDetails = BlockDetails{0, s.info().difficulty(), h256(), {}};
m_details[m_genesisHash] = genesisDetails;
auto const genesisDetailsRlp = genesisDetails.rlp();
m_extrasDB->insert(
toSlice(m_genesisHash, ExtraDetails), (db::Slice)dev::ref(genesisDetailsRlp));

LOG(m_loggerInfo) << "Rebuilding the extras and state databases by reimporting blocks 0 -> "
<< originalNumber << ", this will probably take a while";
Expand Down

0 comments on commit f8b1362

Please sign in to comment.