mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 04:55:18 +00:00
consensus: update state machine to use the new consensus params (#8181)
This commit is contained in:
@@ -161,6 +161,27 @@ func DefaultTimeoutParams() TimeoutParams {
|
||||
}
|
||||
}
|
||||
|
||||
// ProposeTimeout returns the amount of time to wait for a proposal.
|
||||
func (t TimeoutParams) ProposeTimeout(round int32) time.Duration {
|
||||
return time.Duration(
|
||||
t.Propose.Nanoseconds()+t.ProposeDelta.Nanoseconds()*int64(round),
|
||||
) * time.Nanosecond
|
||||
}
|
||||
|
||||
// VoteTimeout returns the amount of time to wait for remaining votes after receiving any +2/3 votes.
|
||||
func (t TimeoutParams) VoteTimeout(round int32) time.Duration {
|
||||
return time.Duration(
|
||||
t.Vote.Nanoseconds()+t.VoteDelta.Nanoseconds()*int64(round),
|
||||
) * time.Nanosecond
|
||||
}
|
||||
|
||||
// CommitTime accepts ti, the time at which the consensus engine received +2/3
|
||||
// precommits for a block and returns the point in time at which the consensus
|
||||
// engine should begin consensus on the next block.
|
||||
func (t TimeoutParams) CommitTime(ti time.Time) time.Time {
|
||||
return ti.Add(t.Commit)
|
||||
}
|
||||
|
||||
func (val *ValidatorParams) IsValidPubkeyType(pubkeyType string) bool {
|
||||
for i := 0; i < len(val.PubKeyTypes); i++ {
|
||||
if val.PubKeyTypes[i] == pubkeyType {
|
||||
|
||||
Reference in New Issue
Block a user