8
8
"os"
9
9
"path/filepath"
10
10
"time"
11
-
12
- tmtime "github.com/tendermint/tendermint/types/time"
13
11
)
14
12
15
13
const (
@@ -946,10 +944,11 @@ type ConsensusConfig struct {
946
944
TimeoutPrecommit time.Duration `mapstructure:"timeout_precommit"`
947
945
// How much the timeout_precommit increases with each round
948
946
TimeoutPrecommitDelta time.Duration `mapstructure:"timeout_precommit_delta"`
949
- // TargetHeigtDuration is used to determine how long we wait after a
950
- // block is committed. If this time is shorter than the actual time to reach
951
- // consensus for that height, then we do not wait at all.
952
- TargetHeightDuration time.Duration `mapstructure:"target_height_duration"`
947
+ // How long we wait after committing a block, before starting on the new
948
+ // height (this gives us a chance to receive some more precommits, even
949
+ // though we already have +2/3).
950
+ // NOTE: when modifying, make sure to update time_iota_ms genesis parameter
951
+ TimeoutCommit time.Duration `mapstructure:"timeout_commit"`
953
952
954
953
// Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
955
954
SkipTimeoutCommit bool `mapstructure:"skip_timeout_commit"`
@@ -969,13 +968,13 @@ type ConsensusConfig struct {
969
968
func DefaultConsensusConfig () * ConsensusConfig {
970
969
return & ConsensusConfig {
971
970
WalPath : filepath .Join (defaultDataDir , "cs.wal" , "wal" ),
972
- TimeoutPropose : 2000 * time .Millisecond ,
971
+ TimeoutPropose : 3000 * time .Millisecond ,
973
972
TimeoutProposeDelta : 500 * time .Millisecond ,
974
973
TimeoutPrevote : 1000 * time .Millisecond ,
975
974
TimeoutPrevoteDelta : 500 * time .Millisecond ,
976
975
TimeoutPrecommit : 1000 * time .Millisecond ,
977
976
TimeoutPrecommitDelta : 500 * time .Millisecond ,
978
- TargetHeightDuration : 3000 * time .Millisecond ,
977
+ TimeoutCommit : 1000 * time .Millisecond ,
979
978
SkipTimeoutCommit : false ,
980
979
CreateEmptyBlocks : true ,
981
980
CreateEmptyBlocksInterval : 0 * time .Second ,
@@ -995,7 +994,7 @@ func TestConsensusConfig() *ConsensusConfig {
995
994
cfg .TimeoutPrecommit = 10 * time .Millisecond
996
995
cfg .TimeoutPrecommitDelta = 1 * time .Millisecond
997
996
// NOTE: when modifying, make sure to update time_iota_ms (testGenesisFmt) in toml.go
998
- cfg .TargetHeightDuration = 70 * time .Millisecond
997
+ cfg .TimeoutCommit = 10 * time .Millisecond
999
998
cfg .SkipTimeoutCommit = true
1000
999
cfg .PeerGossipSleepDuration = 5 * time .Millisecond
1001
1000
cfg .PeerQueryMaj23SleepDuration = 250 * time .Millisecond
@@ -1029,14 +1028,10 @@ func (cfg *ConsensusConfig) Precommit(round int32) time.Duration {
1029
1028
) * time .Nanosecond
1030
1029
}
1031
1030
1032
- // NextStartTime adds the TargetHeightDuration to the provided starting time.
1033
- func (cfg * ConsensusConfig ) NextStartTime (t time.Time ) time.Time {
1034
- newStartTime := t .Add (cfg .TargetHeightDuration )
1035
- now := tmtime .Now ()
1036
- if newStartTime .Before (now ) {
1037
- return now
1038
- }
1039
- return newStartTime
1031
+ // Commit returns the amount of time to wait for straggler votes after receiving +2/3 precommits
1032
+ // for a single block (ie. a commit).
1033
+ func (cfg * ConsensusConfig ) Commit (t time.Time ) time.Time {
1034
+ return t .Add (cfg .TimeoutCommit )
1040
1035
}
1041
1036
1042
1037
// WalFile returns the full path to the write-ahead log file
@@ -1073,8 +1068,8 @@ func (cfg *ConsensusConfig) ValidateBasic() error {
1073
1068
if cfg .TimeoutPrecommitDelta < 0 {
1074
1069
return errors .New ("timeout_precommit_delta can't be negative" )
1075
1070
}
1076
- if cfg .TargetHeightDuration < 0 {
1077
- return errors .New ("target_height_duration can't be negative" )
1071
+ if cfg .TimeoutCommit < 0 {
1072
+ return errors .New ("timeout_commit can't be negative" )
1078
1073
}
1079
1074
if cfg .CreateEmptyBlocksInterval < 0 {
1080
1075
return errors .New ("create_empty_blocks_interval can't be negative" )
0 commit comments