Skip to content

Commit 5ab5dc6

Browse files
committed
Fix a bug that Tendermint fails when a locked proposal is not imported
1 parent 79f1b3b commit 5ab5dc6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/src/consensus/tendermint/worker.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,13 @@ impl Worker {
657657
TwoThirdsMajority::Lock(_, block_hash) => Some(*block_hash),
658658
};
659659
let block_hash = block_hash_candidate.filter(|hash| {
660-
let block =
661-
self.client().block(&BlockId::Hash(*hash)).expect("Already got imported block hash");
660+
let block = match self.client().block(&BlockId::Hash(*hash)) {
661+
Some(block) => block,
662+
// When a node locks on a proposal and doesn't imported the proposal yet,
663+
// we could not check the proposal's generated time.
664+
// To make the network healthier in the corner case, we send a prevote message to the locked block.
665+
None => return true,
666+
};
662667
self.is_generation_time_relevant(&block.decode_header())
663668
});
664669
self.generate_and_broadcast_message(block_hash, is_restoring);

0 commit comments

Comments
 (0)