Skip to content

Commit

Permalink
fix: pillar block save
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrankovi committed Oct 31, 2024
1 parent bfa3f7e commit 13fa82b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libraries/core_libs/consensus/src/pbft/pbft_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ PbftManager::PbftManager(const FullNodeConfig &conf, std::shared_ptr<DbStorage>
const auto &node_addr = node_addr_;
LOG_OBJECTS_CREATE("PBFT_MGR");

auto current_pbft_period = pbft_chain_->getPbftChainSize();
if (kGenesisConfig.state.hardforks.ficus_hf.isPillarBlockPeriod(current_pbft_period)) {
const auto current_pillar_block = pillar_chain_mgr_->getCurrentPillarBlock();
// There is a race condition where pbt block could have been saved and node stopped before saving pillar block
if (current_pbft_period ==
current_pillar_block->getPeriod() + kGenesisConfig.state.hardforks.ficus_hf.pillar_blocks_interval)
LOG(log_er_) << "Pillar block was not processed before restart, current period: " << current_pbft_period
<< ", current pillar block period: " << current_pillar_block->getPeriod();
processPillarBlock(current_pbft_period);
}

for (auto period = final_chain_->lastBlockNumber() + 1, curr_period = pbft_chain_->getPbftChainSize();
period <= curr_period; ++period) {
auto period_raw = db_->getPeriodDataRaw(period);
Expand Down

0 comments on commit 13fa82b

Please sign in to comment.