Skip to content

Commit

Permalink
avoid sending last prepare.
Browse files Browse the repository at this point in the history
  • Loading branch information
oldcold committed Aug 26, 2019
1 parent 889161d commit b097d3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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

0 comments on commit b097d3e

Please sign in to comment.