diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f1ef031e4..789361078b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ FEATURES * [tools] Switch gometalinter to the stable version * [tools] Add checking for misspellings and for incorrectly formatted files in circle CI * [server] Default config now creates a profiler at port 6060, and increase p2p send/recv rates +* [tests] Add WaitForNextNBlocksTM helper method FIXES * \#1259 - fix bug where certain tests that could have a nil pointer in defer diff --git a/tests/util.go b/tests/util.go index 9e2c0d0446..cc95f1e241 100644 --- a/tests/util.go +++ b/tests/util.go @@ -15,13 +15,19 @@ import ( // Wait for the next tendermint block from the Tendermint RPC // on localhost func WaitForNextHeightTM(port string) { + WaitForNextNBlocksTM(1, port) +} + +// Wait for N tendermint blocks to pass using the Tendermint RPC +// on localhost +func WaitForNextNBlocksTM(n int64, port string) { url := fmt.Sprintf("http://localhost:%v", port) cl := tmclient.NewHTTP(url, "/websocket") resBlock, err := cl.Block(nil) if err != nil { panic(err) } - waitForHeightTM(resBlock.Block.Height+1, url) + waitForHeightTM(resBlock.Block.Height+n, url) } // Wait for the given height from the Tendermint RPC