Skip to content

Commit 8851fcc

Browse files
majectymergify[bot]
authored andcommitted
Fix a bug that Tendermint fails when a locked proposal is not imported
1 parent efe56bb commit 8851fcc

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
@@ -655,8 +655,13 @@ impl Worker {
655655
TwoThirdsMajority::Lock(_, block_hash) => Some(*block_hash),
656656
};
657657
let block_hash = block_hash_candidate.filter(|hash| {
658-
let block =
659-
self.client().block(&BlockId::Hash(*hash)).expect("Already got imported block hash");
658+
let block = match self.client().block(&BlockId::Hash(*hash)) {
659+
Some(block) => block,
660+
// When a node locks on a proposal and doesn't imported the proposal yet,
661+
// we could not check the proposal's generated time.
662+
// To make the network healthier in the corner case, we send a prevote message to the locked block.
663+
None => return true,
664+
};
660665
self.is_generation_time_relevant(&block.decode_header())
661666
});
662667
self.generate_and_broadcast_message(block_hash, is_restoring);

0 commit comments

Comments
 (0)