Skip to content

Commit

Permalink
Verify hardfork block is part of the chain
Browse files Browse the repository at this point in the history
Signed-off-by: ice-charon <[email protected]>
  • Loading branch information
ice-charon committed Jul 31, 2024
1 parent 63fca33 commit b3db409
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion validator/manager-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,14 @@ void ValidatorManagerMasterchainStarter::got_hardforks(std::vector<BlockIdExt> v
return;
}
if (h.size() == vec.size()) {
if (h.empty() || *h.rbegin() == *vec.rbegin()) {
// if hardfork is applied, block should exist in blockchain
auto hardfork_is_applied = h.empty() || *h.rbegin() == *vec.rbegin();
if (!h.empty() && *h.rbegin() == *vec.rbegin()) {
ton::BlockIdExt blkid;
hardfork_is_applied = state_->get_old_mc_block_id(h.rbegin()->seqno(), blkid)
&& blkid == *h.rbegin();
}
if (hardfork_is_applied) {
if (opts_->need_db_truncate()) {
auto seq = opts_->get_truncate_seqno();
if (seq <= handle_->id().seqno()) {
Expand Down

0 comments on commit b3db409

Please sign in to comment.