Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

allow fix_irreversible_block to without index file #10086

Merged
merged 1 commit into from
Feb 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions libraries/chain/block_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,15 @@ namespace eosio { namespace chain {

genesis_written_to_block_log = true; // Assume it was constructed properly.

auto reconstruct_index = [&]() {
if (config.fix_irreversible_blocks) {
block_log::repair_log(block_file.get_file_path().parent_path(), UINT32_MAX);
block_log::construct_index(block_file.get_file_path(), index_file.get_file_path());
} else {
log_data.construct_index(index_file.get_file_path());
}
};

if (index_size) {
ilog("Index is nonempty");
if (index_size % sizeof(uint64_t) == 0) {
Expand All @@ -668,17 +677,11 @@ namespace eosio { namespace chain {
}
}
else {
if (config.fix_irreversible_blocks) {
block_log::repair_log(block_file.get_file_path().parent_path(), UINT32_MAX);
block_log::construct_index(block_file.get_file_path(), index_file.get_file_path());
}
else {
log_data.construct_index(index_file.get_file_path());
}
reconstruct_index();
}
} else {
ilog("Index is empty. Reconstructing index...");
log_data.construct_index(index_file.get_file_path());
reconstruct_index();
}
} else if (index_size) {
ilog("Log file is empty while the index file is nonempty, discard the index file");
Expand Down