Skip to content

Commit

Permalink
migrate off deprecated grpc client func
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Jun 4, 2024
1 parent 0881f60 commit d18d607
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions state/core_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/proto/tendermint/crypto"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials/insecure"

"github.com/celestiaorg/celestia-app/app"
Expand Down Expand Up @@ -151,14 +152,20 @@ func (ca *CoreAccessor) Start(ctx context.Context) error {

// dial given celestia-core endpoint
endpoint := fmt.Sprintf("%s:%s", ca.coreIP, ca.grpcPort)
client, err := grpc.DialContext(
ctx,
client, err := grpc.NewClient(
endpoint,
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
return err
}
// this ensures we can't start the node without core connection
client.Connect()
if !client.WaitForStateChange(ctx, connectivity.Ready) {
// hits the case when context is canceled
return fmt.Errorf("couldn't connect to core endpoint(%s): %w", endpoint, ctx.Err())
}

ca.coreConn = client

// create the staking query client
Expand Down

0 comments on commit d18d607

Please sign in to comment.