mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 21:14:53 +00:00
In #5488 the E2E testnet generator changed to setting explicit `StartAt` heights for initial nodes. This broke the runner, which expected all initial nodes to have `StartAt: 0`, as well as validator set scheduling in the generator. Testnet loading now normalizes initial nodes to have `StartAt: 0`. This also tweaks waiting for misbehavior heights to only use an additional wait if there actually is any misbehavior in the testnet, and to output information when waiting.
29 lines
677 B
Go
29 lines
677 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
|
|
)
|
|
|
|
// Wait waits for a number of blocks to be produced, and for all nodes to catch
|
|
// up with it.
|
|
func Wait(testnet *e2e.Testnet, blocks int64) error {
|
|
block, _, err := waitForHeight(testnet, 0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return WaitUntil(testnet, block.Height+blocks)
|
|
}
|
|
|
|
// WaitUntil waits until a given height has been reached.
|
|
func WaitUntil(testnet *e2e.Testnet, height int64) error {
|
|
logger.Info(fmt.Sprintf("Waiting for all nodes to reach height %v...", height))
|
|
_, err := waitForAllNodes(testnet, height, 20*time.Second)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|