diff --git a/beacon-chain/rpc/BUILD.bazel b/beacon-chain/rpc/BUILD.bazel index 826a98179..864995b32 100644 --- a/beacon-chain/rpc/BUILD.bazel +++ b/beacon-chain/rpc/BUILD.bazel @@ -39,6 +39,7 @@ go_library( "@com_github_sirupsen_logrus//:go_default_library", "@io_opencensus_go//plugin/ocgrpc:go_default_library", "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//connectivity:go_default_library", "@org_golang_google_grpc//credentials:go_default_library", "@org_golang_google_grpc//peer:go_default_library", "@org_golang_google_grpc//reflection:go_default_library", diff --git a/beacon-chain/rpc/service.go b/beacon-chain/rpc/service.go index b6cebbc69..e578fbe76 100644 --- a/beacon-chain/rpc/service.go +++ b/beacon-chain/rpc/service.go @@ -40,6 +40,7 @@ import ( "github.com/sirupsen/logrus" "go.opencensus.io/plugin/ocgrpc" "google.golang.org/grpc" + "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" "google.golang.org/grpc/peer" "google.golang.org/grpc/reflection" @@ -341,6 +342,11 @@ func (s *Service) startSlasherClient() { log.Errorf("Could not dial endpoint: %s, %v", s.slasherProvider, err) return } + if conn.GetState() != connectivity.Ready { + log.Errorf("Slasher status is %s, please verify slasher is up", conn.GetState()) + return + } + log.Info("Successfully started hash slinging slasher©️ gRPC connection") s.slasherConn = conn s.slasherClient = slashpb.NewSlasherClient(s.slasherConn)