refactor(server): use interface instead of full Application type (#23420)

This commit is contained in:
Matt Kocubinski
2025-01-17 00:58:43 +01:00
committed by GitHub
parent b885d8a808
commit 514ce9e0a8
+6 -2
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"net"
gogogrpc "github.com/cosmos/gogoproto/grpc"
"google.golang.org/grpc"
"cosmossdk.io/log"
@@ -14,13 +15,16 @@ import (
"github.com/cosmos/cosmos-sdk/server/config"
"github.com/cosmos/cosmos-sdk/server/grpc/gogoreflection"
reflection "github.com/cosmos/cosmos-sdk/server/grpc/reflection/v2alpha1"
"github.com/cosmos/cosmos-sdk/server/types"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino" // Import amino.proto file for reflection
)
type grpcApp interface {
RegisterGRPCServerWithSkipCheckHeader(gogogrpc.Server, bool)
}
// NewGRPCServer returns a correctly configured and initialized gRPC server.
// Note, the caller is responsible for starting the server. See StartGRPCServer.
func NewGRPCServer(clientCtx client.Context, app types.Application, cfg config.GRPCConfig) (*grpc.Server, error) {
func NewGRPCServer(clientCtx client.Context, app grpcApp, cfg config.GRPCConfig) (*grpc.Server, error) {
maxSendMsgSize := cfg.MaxSendMsgSize
if maxSendMsgSize == 0 {
maxSendMsgSize = config.DefaultGRPCMaxSendMsgSize