Add RPC/getHealth

This commit is contained in:
Slavomir 2021-07-01 16:00:31 +02:00
parent 276b3be196
commit 18b50cfa50
1 changed files with 18 additions and 0 deletions

18
rpc/getHealth.go Normal file
View File

@ -0,0 +1,18 @@
package rpc
import (
"context"
)
// GetHealth returns the current health of the node.
// If one or more --trusted-validator arguments are provided
// to solana-validator, "ok" is returned when the node has within
// HEALTH_CHECK_SLOT_DISTANCE slots of the highest trusted validator,
// otherwise an error is returned. "ok" is always returned if no
// trusted validators are provided.
func (cl *Client) GetHealth(ctx context.Context) (out string, err error) {
err = cl.rpcClient.CallFor(&out, "getHealth")
return
}
const HealthOk = "ok"