Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IF: use the same way to determine if instant finality is active #2043

Merged
merged 4 commits into from
Jan 6, 2024
Merged
Changes from 1 commit
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
12 changes: 2 additions & 10 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2796,16 +2796,8 @@ struct controller_impl {

// thread safe, expected to be called from thread other than the main thread
block_state_legacy_ptr create_block_state_i( const block_id_type& id, const signed_block_ptr& b, const block_header_state_legacy& prev ) {
bool hs_active = false;
if (!b->header_extensions.empty()) {
std::optional<block_header_extension> instant_finality_ext = b->extract_header_extension(instant_finality_extension::extension_id());
#warning change to use instant_finality_ext https://github.com/AntelopeIO/leap/issues/1508
if (instant_finality_ext) {
const auto& ext = std::get<instant_finality_extension>(*instant_finality_ext);
hs_active = !!ext.new_proposer_policy;
}
}

uint32_t hs_lib = hs_irreversible_block_num.load();
heifner marked this conversation as resolved.
Show resolved Hide resolved
const bool hs_active = hs_lib > 0;
auto trx_mroot = calculate_trx_merkle( b->transactions, hs_active );
EOS_ASSERT( b->transaction_mroot == trx_mroot, block_validate_exception,
"invalid block transaction merkle root ${b} != ${c}", ("b", b->transaction_mroot)("c", trx_mroot) );
Expand Down