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

Aleth uses genesis block as latest block when performing rebuild in response to database minor version mismatch #5822

@halfalicious

Description

@halfalicious

Even if we address #5813 and persist the minor version to disk, BlockChain::open() renames the extras database path on minor version mismatch:

if (c_minorProtocolVersion != lastMinor)
{
cnote << "Killing extras database " << extrasPath << " (DB minor version:" << lastMinor
<< " != our minor version: " << c_minorProtocolVersion << ").";
DEV_IGNORE_EXCEPTIONS(fs::remove_all(extrasPath / fs::path("details.old")));
fs::rename(extrasSubPathExtras, extrasPath / fs::path("extras.old"));
fs::remove_all(extrasPath / fs::path("state"));
writeFile(extrasSubPathMinor, rlp(c_minorProtocolVersion));
lastMinor = (unsigned)RLP(status);
}

It then opens the extras DB from the old path and populates m_lastBlockHash / m_lastBlockNumber to the genesis block since the old path is empty.

Therefore the last block hash used by BlockChain::rebuild() to identify the range of blocks which need to be reimported will be the genesis block, and the extras (and state) databases won't actually be rebuilt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions