Skip to content

Commit 08f5b31

Browse files
committed
Do not generate a seal if the block is generated from a past view
If generating a block takes too much time, the view could be changed before the miner module requests the signature. If the Tendermint module receives a signature request of an old view, it should ignore the message. Before this commit, the Tendermint module was crashing when it gets a signature request from an old view.
1 parent 0f57148 commit 08f5b31

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/src/consensus/tendermint/worker.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,13 @@ impl Worker {
10441044
return Seal::None
10451045
}
10461046

1047-
assert!(self.is_signer_proposer(&parent_hash));
1047+
// We don't know at which view the node starts generating a block.
1048+
// If this node's signer is not proposer at the current view, return none.
1049+
if !self.is_signer_proposer(&parent_hash) {
1050+
cwarn!(ENGINE, "Seal request for an old view");
1051+
return Seal::None
1052+
}
1053+
10481054
assert_eq!(Proposal::None, self.proposal);
10491055
assert_eq!(height, self.height);
10501056

0 commit comments

Comments
 (0)