celestia-node
celestia-node copied to clipboard
fix(grpc): correctly wait for ClientConn to reach Ready state
The previous readiness check used WaitForStateChange(ctx, connectivity.Ready), which waits for a transition out of Ready rather than into Ready, providing no guarantee that the connection became ready and often returning immediately. This caused startup paths and tests to proceed without a truly established gRPC connection. This change replaces that usage with a proper loop that calls Connect(), polls GetState(), breaks on Ready, fails on Shutdown, and uses WaitForStateChange(ctx, state) with the provided context for timeouts. This ensures connections are actually ready before proceeding.