mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-01 13:47:07 +00:00
lint++
This commit is contained in:
+1
-2
@@ -8,7 +8,6 @@ import (
|
||||
"sync"
|
||||
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/inspect/rpc"
|
||||
inspect_rpc "github.com/tendermint/tendermint/inspect/rpc"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmstrings "github.com/tendermint/tendermint/libs/strings"
|
||||
@@ -120,7 +119,7 @@ func startRPCServers(ctx context.Context, rpcConfig *cfg.RPCConfig, logger log.L
|
||||
rootHandler := inspect_rpc.Handler(rpcConfig, routes, logger)
|
||||
errChan := make(chan error)
|
||||
for _, listenerAddr := range listenAddrs {
|
||||
server := rpc.Server{
|
||||
server := inspect_rpc.Server{
|
||||
Logger: logger,
|
||||
Config: rpcConfig,
|
||||
Handler: rootHandler,
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
abci_types "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/config"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/inspect"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
"github.com/tendermint/tendermint/libs/pubsub/query"
|
||||
@@ -26,11 +25,11 @@ import (
|
||||
)
|
||||
|
||||
func TestInspectConstructor(t *testing.T) {
|
||||
config := cfg.ResetTestRoot("test")
|
||||
cfg := config.ResetTestRoot("test")
|
||||
t.Cleanup(leaktest.Check(t))
|
||||
defer func() { _ = os.RemoveAll(config.RootDir) }()
|
||||
defer func() { _ = os.RemoveAll(cfg.RootDir) }()
|
||||
t.Run("from config", func(t *testing.T) {
|
||||
d, err := inspect.NewFromConfig(config)
|
||||
d, err := inspect.NewFromConfig(cfg)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, d)
|
||||
})
|
||||
@@ -38,11 +37,11 @@ func TestInspectConstructor(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInspectRun(t *testing.T) {
|
||||
config := cfg.ResetTestRoot("test")
|
||||
cfg := config.ResetTestRoot("test")
|
||||
t.Cleanup(leaktest.Check(t))
|
||||
defer func() { _ = os.RemoveAll(config.RootDir) }()
|
||||
defer func() { _ = os.RemoveAll(cfg.RootDir) }()
|
||||
t.Run("from config", func(t *testing.T) {
|
||||
d, err := inspect.NewFromConfig(config)
|
||||
d, err := inspect.NewFromConfig(cfg)
|
||||
require.NoError(t, err)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
wg := &sync.WaitGroup{}
|
||||
|
||||
+2
-4
@@ -9,9 +9,7 @@ import (
|
||||
"github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmpubsub "github.com/tendermint/tendermint/libs/pubsub"
|
||||
"github.com/tendermint/tendermint/rpc/core"
|
||||
rpccore "github.com/tendermint/tendermint/rpc/core"
|
||||
"github.com/tendermint/tendermint/rpc/jsonrpc/server"
|
||||
rpcserver "github.com/tendermint/tendermint/rpc/jsonrpc/server"
|
||||
"github.com/tendermint/tendermint/state"
|
||||
"github.com/tendermint/tendermint/state/indexer"
|
||||
@@ -28,7 +26,7 @@ type Server struct {
|
||||
|
||||
// Routes returns the set of routes used by the Inspect server.
|
||||
func Routes(store state.Store, blockStore state.BlockStore, eventSinks []indexer.EventSink) rpccore.RoutesMap {
|
||||
env := &core.Environment{
|
||||
env := &rpccore.Environment{
|
||||
EventSinks: eventSinks,
|
||||
StateStore: store,
|
||||
BlockStore: blockStore,
|
||||
@@ -114,7 +112,7 @@ func (srv *Server) ListenAndServeTLS(ctx context.Context, certFile, keyFile stri
|
||||
return rpcserver.ServeTLS(listener, srv.Handler, certFile, keyFile, srv.Logger, serverRPCConfig(srv.Config))
|
||||
}
|
||||
|
||||
func serverRPCConfig(r *config.RPCConfig) *server.Config {
|
||||
func serverRPCConfig(r *config.RPCConfig) *rpcserver.Config {
|
||||
cfg := rpcserver.DefaultConfig()
|
||||
cfg.MaxBodyBytes = r.MaxBodyBytes
|
||||
cfg.MaxHeaderBytes = r.MaxHeaderBytes
|
||||
|
||||
Reference in New Issue
Block a user