diff --git a/rpc/client/helpers.go b/rpc/client/helpers.go index 027964ac9..e41c2d657 100644 --- a/rpc/client/helpers.go +++ b/rpc/client/helpers.go @@ -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 diff --git a/rpc/client/helpers_test.go b/rpc/client/helpers_test.go index 13b3b1d03..cef462475 100644 --- a/rpc/client/helpers_test.go +++ b/rpc/client/helpers_test.go @@ -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)