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 never persists database minor version #5813

@halfalicious

Description

@halfalicious

Aleth checks the minor version when opening the various databases - however, Aleth only persists the minor version to a file if the file already exists and contains a different value than Aleth expects (c_minorProtocolVersion). Aleth should obviously also persist the minor protocol version if the file doesn't already exist, since otherwise the file will never be created in the first place.

Relevant code is here (BlockChain::open):

auto const extrasSubPathMinor = extrasPath / fs::path("minor");
bytes const status = contents(extrasSubPathMinor);
if (!status.empty())
DEV_IGNORE_EXCEPTIONS(lastMinor = (unsigned)RLP(status));
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);
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions