Bump Tendermint version (#6300)

This commit is contained in:
Alexander Bezobchuk
2020-05-28 14:46:28 +00:00
committed by GitHub
parent 4927f80dfc
commit f8bad078b7
4 changed files with 15 additions and 10 deletions
+7 -7
View File
@@ -13,7 +13,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/tendermint/libs/log"
rpcserver "github.com/tendermint/tendermint/rpc/lib/server"
tmrpcserver "github.com/tendermint/tendermint/rpc/jsonrpc/server"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/flags"
@@ -48,13 +48,13 @@ func NewRestServer(cdc *codec.Codec) *RestServer {
// StartWithConfig starts the REST server that listens on the provided listenAddr.
// It will use the provided RPC configuration.
func (rs *RestServer) StartWithConfig(listenAddr string, cors bool, cfg *rpcserver.Config) error {
func (rs *RestServer) StartWithConfig(listenAddr string, cors bool, cfg *tmrpcserver.Config) error {
server.TrapSignal(func() {
err := rs.listener.Close()
rs.log.Error("error closing listener", "err", err)
})
listener, err := rpcserver.Listen(listenAddr, cfg)
listener, err := tmrpcserver.Listen(listenAddr, cfg)
if err != nil {
return err
}
@@ -68,17 +68,17 @@ func (rs *RestServer) StartWithConfig(listenAddr string, cors bool, cfg *rpcserv
var h http.Handler = rs.Mux
if cors {
return rpcserver.StartHTTPServer(rs.listener, handlers.CORS()(h), rs.log, cfg)
return tmrpcserver.Serve(rs.listener, handlers.CORS()(h), rs.log, cfg)
}
return rpcserver.StartHTTPServer(rs.listener, rs.Mux, rs.log, cfg)
return tmrpcserver.Serve(rs.listener, rs.Mux, rs.log, cfg)
}
// Start starts the REST server that listens on the provided listenAddr. The REST
// service will use Tendermint's default RPC configuration, where the R/W timeout
// and max open connections are overridden.
func (rs *RestServer) Start(listenAddr string, maxOpen int, readTimeout, writeTimeout uint, cors bool) error {
cfg := rpcserver.DefaultConfig()
cfg := tmrpcserver.DefaultConfig()
cfg.MaxOpenConnections = maxOpen
cfg.ReadTimeout = time.Duration(readTimeout) * time.Second
cfg.WriteTimeout = time.Duration(writeTimeout) * time.Second
@@ -99,7 +99,7 @@ func ServeCommand(cdc *codec.Codec, registerRoutesFn func(*RestServer)) *cobra.C
registerRoutesFn(rs)
rs.registerSwaggerUI()
cfg := rpcserver.DefaultConfig()
cfg := tmrpcserver.DefaultConfig()
cfg.MaxOpenConnections = viper.GetInt(flags.FlagMaxOpenConnections)
cfg.ReadTimeout = time.Duration(viper.GetInt64(flags.FlagRPCReadTimeout)) * time.Second
cfg.WriteTimeout = time.Duration(viper.GetInt64(flags.FlagRPCWriteTimeout)) * time.Second