From 7ef827ed31619e6040e1e68e9712247408b8c52d Mon Sep 17 00:00:00 2001 From: Juhyung Park Date: Mon, 23 Sep 2019 18:26:38 +0900 Subject: [PATCH 1/2] If best block is not changed don't move to the next height --- core/src/consensus/tendermint/worker.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/consensus/tendermint/worker.rs b/core/src/consensus/tendermint/worker.rs index a71b069ac0..2593031fef 100644 --- a/core/src/consensus/tendermint/worker.rs +++ b/core/src/consensus/tendermint/worker.rs @@ -1312,7 +1312,11 @@ impl Worker { view, } => { cinfo!(ENGINE, "Commit timeout."); - if self.client().block(&block_hash.into()).is_none() { + + let proposal_imported = self.client().block(&block_hash.into()).is_some(); + let best_block_header = self.client().best_block_header(); + + if !proposal_imported || best_block_header.hash() != block_hash { cwarn!(ENGINE, "Best chain is not updated yet, wait until imported"); self.step = TendermintState::CommitTimedout { block_hash, From a1fde5c547bd0a2304913035cec4c89946c1bbe5 Mon Sep 17 00:00:00 2001 From: Juhyung Park Date: Mon, 23 Sep 2019 18:30:36 +0900 Subject: [PATCH 2/2] Call new_blocks even though block verification queue is not empty new_blocks was called when the block verification queue is empty. The purpose of the behavior is not clear. Maybe it was used to backpressure for block sync extension. Since we have another block sync flow control and tendermint assumes that new_blocks is always called, this commit changed the behavior of new_blocks to be always called. --- core/src/client/importer.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/client/importer.rs b/core/src/client/importer.rs index b010b5e06b..d039b36e22 100644 --- a/core/src/client/importer.rs +++ b/core/src/client/importer.rs @@ -144,7 +144,10 @@ impl Importer { }; { - if !imported_blocks.is_empty() && is_empty { + if !imported_blocks.is_empty() { + if !is_empty { + ctrace!(CLIENT, "Call new_blocks even though block verification queue is not empty"); + } let (enacted, retracted) = self.calculate_enacted_retracted(&import_results); self.miner.chain_new_blocks(client, &imported_blocks, &invalid_blocks, &enacted, &retracted); client.new_blocks(&imported_blocks, &invalid_blocks, &enacted, &retracted, &[], duration);