Skip to content

Commit

Permalink
When decide via sync skip commit timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ancazamfir committed Feb 7, 2025
1 parent 614a46c commit 7470351
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions code/crates/core-consensus/src/handle/proposed_value.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::prelude::*;

use crate::handle::decide::decide;
use crate::handle::driver::apply_driver_input;
use crate::types::ProposedValue;

Expand Down Expand Up @@ -78,5 +79,19 @@ where
.await?;
}

if origin == ValueOrigin::Sync && state.driver.step_is_commit() {
perform!(
co,
Effect::CancelTimeout(Timeout::commit(state.driver.round()), Default::default())
);
let height = state.driver.height();
let round = state.driver.round();
let proposal = state
.decision
.remove(&(height, round))
.ok_or_else(|| Error::DecidedValueNotFound(height, round))?;

decide(co, state, metrics, round, proposal).await?;
}
Ok(())
}
17 changes: 17 additions & 0 deletions code/crates/core-consensus/src/handle/sync.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::handle::decide::decide;
use crate::handle::driver::apply_driver_input;
use crate::handle::signature::verify_certificate;
use crate::handle::validator_set::get_validator_set;
Expand Down Expand Up @@ -41,5 +42,21 @@ where
)
.await?;

if state.driver.step_is_commit() {
perform!(
co,
Effect::CancelTimeout(Timeout::commit(state.driver.round()), Default::default())
);

let height = state.driver.height();
let round = state.driver.round();
let proposal = state
.decision
.remove(&(height, round))
.ok_or_else(|| Error::DecidedValueNotFound(height, round))?;

decide(co, state, metrics, round, proposal).await?;
}

Ok(())
}

0 comments on commit 7470351

Please sign in to comment.