mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-09 11:31:19 +00:00
change delta's type from int to int64
This commit is contained in:
parent
cd5a5d332f
commit
d41c0b10c8
@ -10,11 +10,11 @@ import (
|
||||
)
|
||||
|
||||
// Waiter is informed of current height, decided whether to quit early
|
||||
type Waiter func(delta int) (abort error)
|
||||
type Waiter func(delta int64) (abort error)
|
||||
|
||||
// DefaultWaitStrategy is the standard backoff algorithm,
|
||||
// but you can plug in another one
|
||||
func DefaultWaitStrategy(delta int) (abort error) {
|
||||
func DefaultWaitStrategy(delta int64) (abort error) {
|
||||
if delta > 10 {
|
||||
return errors.Errorf("Waiting for %d blocks... aborting", delta)
|
||||
} else if delta > 0 {
|
||||
@ -36,13 +36,13 @@ func WaitForHeight(c StatusClient, h int64, waiter Waiter) error {
|
||||
if waiter == nil {
|
||||
waiter = DefaultWaitStrategy
|
||||
}
|
||||
delta := 1
|
||||
delta := int64(1)
|
||||
for delta > 0 {
|
||||
s, err := c.Status()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
delta = int(h - s.LatestBlockHeight)
|
||||
delta = h - s.LatestBlockHeight
|
||||
// wait for the time, or abort early
|
||||
if err := waiter(delta); err != nil {
|
||||
return err
|
||||
|
@ -50,7 +50,7 @@ func TestWaitForHeight(t *testing.T) {
|
||||
|
||||
// since we can't update in a background goroutine (test --race)
|
||||
// we use the callback to update the status height
|
||||
myWaiter := func(delta int) error {
|
||||
myWaiter := func(delta int64) error {
|
||||
// update the height for the next call
|
||||
m.Call.Response = &ctypes.ResultStatus{LatestBlockHeight: 15}
|
||||
return client.DefaultWaitStrategy(delta)
|
||||
|
Loading…
x
Reference in New Issue
Block a user