Skip to content

Commit

Permalink
Merge pull request #83 from DaoCasino/randpa-problem-investigation-DP…
Browse files Browse the repository at this point in the history
…M-939

DPM-939 randpa problem investigation
  • Loading branch information
adrianopol authored Feb 16, 2021
2 parents a962ec2 + 000aa4d commit fa33ed8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
20 changes: 14 additions & 6 deletions plugins/randpa_plugin/include/eosio/randpa_plugin/randpa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,12 +692,15 @@ class randpa {
return;
}

// when node in syncing or frozen state it's useless to creating new rounds
_is_syncing = event.sync;
_is_frozen = get_block_num(event.block_id) - get_block_num(_lib) > _max_finality_lag_blocks;

// when node in syncing or frozen state it's useless to creating new rounds
if (_is_syncing || _is_frozen) {
randpa_ilog("Randpa omit block while syncing or frozen, id: ${id}", ("id", event.block_id));
if (_is_syncing) {
randpa_ilog("Randpa omit block while syncing, block id: ${id}", ("id", event.block_id));
return;
}
if (_is_frozen) {
randpa_ilog("Randpa omit block while frozen, block id: ${id}", ("id", event.block_id));
return;
}

Expand Down Expand Up @@ -797,11 +800,16 @@ class randpa {

bool should_end_prevote(const block_id_type& block_id) const {
if (!_round) {
randpa_dlog("No active round; no need to finish prevote phase.");
return false;
}

return round_num(block_id) == _round->get_num()
&& num_in_round(block_id) == prevote_width;
bool should_end = round_num(block_id) == _round->get_num() && num_in_round(block_id) == prevote_width;
if (!should_end) {
randpa_dlog("Cannot end prevote phase for block ${b} on round ${r}",
("b", get_block_num(block_id))("r", _round->get_num()));
}
return should_end;
}

bool is_active_bp(const block_id_type& block_id) const {
Expand Down
4 changes: 2 additions & 2 deletions plugins/randpa_plugin/include/eosio/randpa_plugin/round.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class randpa_round {

void on(const prevote_msg& msg) {
if (state != state_type::prevote && state != state_type::ready_to_precommit) {
randpa_dlog("Skipping prevote, round: ${r} (invalid state: ${s})", ("r", num)("s", static_cast<uint32_t>(state)));
randpa_dlog("Skipping prevote for round ${r}: invalid state: ${s}", ("r", num)("s", static_cast<uint32_t>(state)));
return;
}

Expand All @@ -111,7 +111,7 @@ class randpa_round {

void on(const precommit_msg& msg) {
if (state != state_type::precommit && state != state_type::ready_to_precommit) {
randpa_dlog("Skipping precommit, round: ${r}", ("r", num));
randpa_dlog("Skipping precommit for round ${r}: invalid state: ${s}", ("r", num)("s", static_cast<uint32_t>(state)));
return;
}

Expand Down

0 comments on commit fa33ed8

Please sign in to comment.