Add delay before voting begins.
Some checks are pending
Test Workspace / Test Workspace (push) Waiting to run

This commit is contained in:
FiveMovesAhead 2025-01-09 11:25:43 +08:00
parent 715da6cd69
commit 14373ff80c
3 changed files with 4 additions and 2 deletions

View File

@ -212,8 +212,8 @@ pub async fn set_vote<T: Context>(
.get_breakthrough_state(&breakthrough_id)
.await
.ok_or_else(|| anyhow!("Invalid breakthrough '{}'", breakthrough_id))?;
if breakthrough_state.round_pushed > latest_block_details.round
&& latest_block_details.round >= breakthrough_state.round_votes_tallied
if latest_block_details.round < breakthrough_state.round_voting_starts
|| latest_block_details.round >= breakthrough_state.round_votes_tallied
{
return Err(anyhow!("Cannot vote on breakthrough '{}'", breakthrough_id));
}

View File

@ -23,6 +23,7 @@ serializable_struct_with_getters! {
BreakthroughsConfig {
bootstrap_address: String,
min_percent_yes_votes: f64,
vote_start_delay: u32,
vote_period: u32,
min_lock_period_to_vote: u32,
submission_fee: PreciseNumber,

View File

@ -272,6 +272,7 @@ serializable_struct_with_getters! {
block_confirmed: u32,
round_submitted: u32,
round_pushed: u32,
round_voting_starts: u32,
round_votes_tallied: u32,
votes_tally: HashMap<bool, PreciseNumber>,
round_active: Option<u32>,