Skip to content

Commit

Permalink
Merge branch 'main' into andy/3002-invalid-txs-results
Browse files Browse the repository at this point in the history
  • Loading branch information
andynog committed May 24, 2024
2 parents df88eda + dd5f1e6 commit 8cab048
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1174,25 +1174,24 @@ func (cfg *ConsensusConfig) WaitForTxs() bool {
return !cfg.CreateEmptyBlocks || cfg.CreateEmptyBlocksInterval > 0
}

func timeoutTime(baseTimeout, timeoutDelta time.Duration, round int32) time.Duration {
timeout := baseTimeout.Nanoseconds() + timeoutDelta.Nanoseconds()*int64(round)
return time.Duration(timeout) * time.Nanosecond
}

// Propose returns the amount of time to wait for a proposal.
func (cfg *ConsensusConfig) Propose(round int32) time.Duration {
return time.Duration(
cfg.TimeoutPropose.Nanoseconds()+cfg.TimeoutProposeDelta.Nanoseconds()*int64(round),
) * time.Nanosecond
return timeoutTime(cfg.TimeoutPropose, cfg.TimeoutProposeDelta, round)
}

// Prevote returns the amount of time to wait for straggler votes after receiving any +2/3 prevotes.
func (cfg *ConsensusConfig) Prevote(round int32) time.Duration {
return time.Duration(
cfg.TimeoutVote.Nanoseconds()+cfg.TimeoutVoteDelta.Nanoseconds()*int64(round),
) * time.Nanosecond
return timeoutTime(cfg.TimeoutVote, cfg.TimeoutVoteDelta, round)
}

// Precommit returns the amount of time to wait for straggler votes after receiving any +2/3 precommits.
func (cfg *ConsensusConfig) Precommit(round int32) time.Duration {
return time.Duration(
cfg.TimeoutVote.Nanoseconds()+cfg.TimeoutVoteDelta.Nanoseconds()*int64(round),
) * time.Nanosecond
return timeoutTime(cfg.TimeoutVote, cfg.TimeoutVoteDelta, round)
}

// Commit returns the amount of time to wait for straggler votes after receiving +2/3 precommits
Expand Down

0 comments on commit 8cab048

Please sign in to comment.