Skip to content

Commit

Permalink
override
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyding committed Jun 20, 2024
1 parent c8beeea commit 93f7da5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const (

MempoolTypeFlood = "flood"
MempoolTypeNop = "nop"

TimeoutProposeOverride = 1 * time.Second
)

// NOTE: Most of the structs & relevant comments + the
Expand Down Expand Up @@ -981,6 +983,7 @@ type ConsensusConfig struct {
walFile string // overrides WalPath if set

// How long we wait for a proposal block before prevoting nil
// Deprecated: a software default of 1 second is used instead.
TimeoutPropose time.Duration `mapstructure:"timeout_propose"`
// How much timeout_propose increases with each round
TimeoutProposeDelta time.Duration `mapstructure:"timeout_propose_delta"`
Expand Down Expand Up @@ -1058,7 +1061,9 @@ func (cfg *ConsensusConfig) WaitForTxs() bool {
// 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),
// Provide an override for `timeout_propose`. This value should be consistent across the network
// for synchrony, and should never be tweaked by individual validators in practice.
TimeoutProposeOverride.Nanoseconds()+cfg.TimeoutProposeDelta.Nanoseconds()*int64(round),
) * time.Nanosecond
}

Expand Down
1 change: 1 addition & 0 deletions config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ version = "{{ .BlockSync.Version }}"
wal_file = "{{ js .Consensus.WalPath }}"
# How long we wait for a proposal block before prevoting nil
# Deprecated: a software default of 1 second is used instead.
timeout_propose = "{{ .Consensus.TimeoutPropose }}"
# How much timeout_propose increases with each round
timeout_propose_delta = "{{ .Consensus.TimeoutProposeDelta }}"
Expand Down

0 comments on commit 93f7da5

Please sign in to comment.