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

[fix] #3166: don't do view changes when system is idle #3167

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Changes from all commits
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
9 changes: 3 additions & 6 deletions core/src/sumeragi/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,20 +964,17 @@ pub(crate) fn run<F: FaultInjection>(
&mut view_change_time,
);

if last_view_change_time.elapsed() > view_change_time {
let node_expects_block = !state.transaction_cache.is_empty();
if node_expects_block && last_view_change_time.elapsed() > view_change_time {
let role = state.current_topology.role(&sumeragi.peer_id);

if let Some(VotingBlock { block, .. }) = voting_block.as_ref() {
// NOTE: Suspecting the tail node because it hasn't yet committed a block produced by leader
warn!(%role, block=%block.hash(), "Block not committed in due time, requesting view change...");
} else if !state.transaction_cache.is_empty() {
} else {
// NOTE: Suspecting the leader node because it hasn't produced a block
// If the current node has a transaction, the leader should have as well
warn!(%role, "No block produced in due time, requesting view change...");
} else {
// NOTE: There might be an issue with transaction gossiping mechanism
// There is no meaningful performance hit if there are no transactions
info!(%role, "No new transactions, requesting view change...");
}

suggest_view_change(
Expand Down