Skip to content

Commit 59e9ebd

Browse files
majectyforiequal0
authored andcommitted
Set finalized_view to None when restoring in the Commit step
In the Tendermint restoring process, if the backup state is the Commit step, CodeChain set the step to the Precommit step and handles the votes. The purpose of the behavior is that calling functions that are called when enters the Commit state. After we introduce the `finalized_view_of_current_block` variable, the variable should be changed to `None` when CodeChain sets the state to Precommit in the restoring process.
1 parent cc9754e commit 59e9ebd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/consensus/tendermint/worker.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,11 @@ impl Worker {
10331033
let client = self.client();
10341034
let backup = restore(client.get_kvdb().as_ref());
10351035
if let Some(backup) = backup {
1036+
if backup.step == Step::Commit {
1037+
self.finalized_view_of_current_block = None;
1038+
} else {
1039+
self.finalized_view_of_current_block = backup.finalized_view_of_current_block;
1040+
}
10361041
let backup_step = match backup.step {
10371042
Step::Propose => TendermintState::Propose,
10381043
Step::Prevote => TendermintState::Prevote,
@@ -1046,7 +1051,6 @@ impl Worker {
10461051
self.height = backup.height;
10471052
self.view = backup.view;
10481053
self.finalized_view_of_previous_block = backup.finalized_view_of_previous_block;
1049-
self.finalized_view_of_current_block = backup.finalized_view_of_current_block;
10501054

10511055
if let Some(proposal) = backup.proposal {
10521056
if client.block(&BlockId::Hash(proposal)).is_some() {

0 commit comments

Comments
 (0)