consensus: add calculation for proposal step waits from pbts (#7290)

* initial proposerWaitsUntil implementation

* switch to duration for easier use with timeout scheduling

* add proposal step waiting time with tests

* minor aesthetic change to IsTimely

* minor language fix

* Update internal/consensus/state.go

Co-authored-by: M. J. Fromberger <fromberger@interchain.io>

* reword comment

* change accuracy to precision

* move tests to separate pbts test file

Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
This commit is contained in:
William Banfield
2022-01-14 18:31:11 -05:00
committed by William Banfield
co-authored by M. J. Fromberger
parent 89e3f43cbc
commit 32008ae1d8
3 changed files with 152 additions and 1 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ func (p *Proposal) IsTimely(clock tmtime.Source, tp TimestampParams) bool {
lt := clock.Now()
lhs := lt.Add(-tp.Precision)
rhs := lt.Add(tp.Precision).Add(tp.MsgDelay)
if lhs.Before(p.Timestamp) && p.Timestamp.Before(rhs) {
if lhs.Before(p.Timestamp) && rhs.After(p.Timestamp) {
return true
}
return false