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

pbft optimise #123

Merged
4 changes: 3 additions & 1 deletion libraries/chain/pbft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ namespace eosio {
set_view_change_timer(0);

set_current(std::make_shared<psm_committed_state>(*this, pbft_db));
emit(pbft_transit_to_committed, true);
if (!get_prepare_cache().empty()) {
emit(pbft_transit_to_committed, true);
}
}

void psm_machine::transit_to_prepared_state() {
Expand Down
3 changes: 2 additions & 1 deletion libraries/chain/pbft_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ namespace eosio {

if (high_watermark_block_num <= lib) return prepares_to_be_cached;

if (auto hwbs = ctrl.fork_db().get_block_in_current_chain_by_num(high_watermark_block_num)) {
auto hwbs = ctrl.fork_db().get_block_in_current_chain_by_num(high_watermark_block_num);
if ( hwbs && hwbs->id != my_prepare) {
auto sent = false;
for (const auto& sp : my_sps) {
pbft_prepare new_p;
Expand Down