You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
777 B

  1. package main
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/tendermint/tendermint/libs/log"
  6. e2e "github.com/tendermint/tendermint/test/e2e/pkg"
  7. )
  8. // Wait waits for a number of blocks to be produced, and for all nodes to catch
  9. // up with it.
  10. func Wait(ctx context.Context, logger log.Logger, testnet *e2e.Testnet, blocks int64) error {
  11. block, err := getLatestBlock(ctx, testnet)
  12. if err != nil {
  13. return err
  14. }
  15. return WaitUntil(ctx, logger, testnet, block.Height+blocks)
  16. }
  17. // WaitUntil waits until a given height has been reached.
  18. func WaitUntil(ctx context.Context, logger log.Logger, testnet *e2e.Testnet, height int64) error {
  19. logger.Info(fmt.Sprintf("Waiting for all nodes to reach height %v...", height))
  20. _, _, err := waitForHeight(ctx, testnet, height)
  21. return err
  22. }