LatestHeight returns the latest height of the network or an error if the query fails or no validators exist.
()
| 481 | // LatestHeight returns the latest height of the network or an error if the |
| 482 | // query fails or no validators exist. |
| 483 | func (n *Network) LatestHeight() (int64, error) { |
| 484 | if len(n.Validators) == 0 { |
| 485 | return 0, errors.New("no validators available") |
| 486 | } |
| 487 | |
| 488 | status, err := n.Validators[0].RPCClient.Status(context.Background()) |
| 489 | if err != nil { |
| 490 | return 0, err |
| 491 | } |
| 492 | |
| 493 | return status.SyncInfo.LatestBlockHeight, nil |
| 494 | } |
| 495 | |
| 496 | // WaitForHeight performs a blocking check where it waits for a block to be |
| 497 | // committed after a given block. If that height is not reached within a timeout, |
no test coverage detected