mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 04:55:18 +00:00
timeout parameters take the default if not set (#8189)
This commit is contained in:
@@ -147,7 +147,22 @@ func DefaultSynchronyParams() SynchronyParams {
|
||||
Precision: 505 * time.Millisecond,
|
||||
MessageDelay: 12 * time.Second,
|
||||
}
|
||||
}
|
||||
|
||||
// SynchronyParamsOrDefaults returns the SynchronyParams, filling in any zero values
|
||||
// with the Tendermint defined default values.
|
||||
func (s SynchronyParams) SynchronyParamsOrDefaults() SynchronyParams {
|
||||
// TODO: Remove this method and all uses once development on v0.37 begins.
|
||||
// See: https://github.com/tendermint/tendermint/issues/8187
|
||||
|
||||
defaults := DefaultSynchronyParams()
|
||||
if s.Precision == 0 {
|
||||
s.Precision = defaults.Precision
|
||||
}
|
||||
if s.MessageDelay == 0 {
|
||||
s.MessageDelay = defaults.MessageDelay
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func DefaultTimeoutParams() TimeoutParams {
|
||||
@@ -161,6 +176,31 @@ func DefaultTimeoutParams() TimeoutParams {
|
||||
}
|
||||
}
|
||||
|
||||
// TimeoutParamsOrDefaults returns the SynchronyParams, filling in any zero values
|
||||
// with the Tendermint defined default values.
|
||||
func (t TimeoutParams) TimeoutParamsOrDefaults() TimeoutParams {
|
||||
// TODO: Remove this method and all uses once development on v0.37 begins.
|
||||
// See: https://github.com/tendermint/tendermint/issues/8187
|
||||
|
||||
defaults := DefaultTimeoutParams()
|
||||
if t.Propose == 0 {
|
||||
t.Propose = defaults.Propose
|
||||
}
|
||||
if t.ProposeDelta == 0 {
|
||||
t.ProposeDelta = defaults.ProposeDelta
|
||||
}
|
||||
if t.Vote == 0 {
|
||||
t.Vote = defaults.Vote
|
||||
}
|
||||
if t.VoteDelta == 0 {
|
||||
t.VoteDelta = defaults.VoteDelta
|
||||
}
|
||||
if t.Commit == 0 {
|
||||
t.Commit = defaults.Commit
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
// ProposeTimeout returns the amount of time to wait for a proposal.
|
||||
func (t TimeoutParams) ProposeTimeout(round int32) time.Duration {
|
||||
return time.Duration(
|
||||
|
||||
Reference in New Issue
Block a user