Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Upgrade tendermint to 0315 #132

Merged
merged 1 commit into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
[[override]]
name = "github.com/tendermint/tendermint"
source = "github.com/binance-chain/bnc-tendermint"
version = "=v0.30.1-binance.0"
branch = "develop"

## deps without releases:

Expand Down
27 changes: 0 additions & 27 deletions baseapp/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package baseapp

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/tendermint/abci/server"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/tmhash"
cmn "github.com/tendermint/tendermint/libs/common"
)
Expand All @@ -25,28 +23,3 @@ func (app *BaseApp) Deliver(tx sdk.Tx) (result sdk.Result) {
txHash := cmn.HexBytes(tmhash.Sum(nil)).String()
return app.RunTx(sdk.RunTxModeDeliver, nil, tx, txHash)
}

// RunForever - BasecoinApp execution and cleanup
func RunForever(app abci.Application) {

// Start the ABCI server
srv, err := server.NewServer("0.0.0.0:26658", "socket", app)
if err != nil {
cmn.Exit(err.Error())
return
}
err = srv.Start()
if err != nil {
cmn.Exit(err.Error())
return
}

// Wait forever
cmn.TrapSignal(func() {
// Cleanup
err := srv.Stop()
if err != nil {
cmn.Exit(err.Error())
}
})
}
14 changes: 8 additions & 6 deletions client/lcd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
auth "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
bank "github.com/cosmos/cosmos-sdk/x/bank/client/rest"
gov "github.com/cosmos/cosmos-sdk/x/gov/client/rest"
Expand All @@ -21,7 +22,6 @@ import (
"github.com/rakyll/statik/fs"
"github.com/spf13/cobra"
"github.com/spf13/viper"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
tmserver "github.com/tendermint/tendermint/rpc/lib/server"
)
Expand Down Expand Up @@ -58,12 +58,13 @@ func ServeCommand(cdc *codec.Codec) *cobra.Command {
var listener net.Listener
var fingerprint string
if viper.GetBool(flagInsecure) {
listener, err := tmserver.Listen(listenAddr, tmserver.Config{MaxOpenConnections: maxOpen})
cfg := &tmserver.Config{MaxOpenConnections: maxOpen}
listener, err := tmserver.Listen(listenAddr, cfg)
if err != nil {
return err
}
go func() {
if err = tmserver.StartHTTPServer(listener, handler, logger); err != nil {
if err = tmserver.StartHTTPServer(listener, handler, logger, cfg); err != nil {
panic(err)
}
}()
Expand Down Expand Up @@ -91,12 +92,13 @@ func ServeCommand(cdc *codec.Codec) *cobra.Command {
}
defer cleanupFunc()
}
listener, err := tmserver.Listen(listenAddr, tmserver.Config{MaxOpenConnections: maxOpen})
cfg := &tmserver.Config{MaxOpenConnections: maxOpen}
listener, err := tmserver.Listen(listenAddr, cfg)
if err != nil {
return err
}
go func() {
if err = tmserver.StartHTTPServer(listener, handler, logger); err != nil {
if err = tmserver.StartHTTPAndTLSServer(listener, handler, certFile, keyFile, logger, cfg); err != nil {
panic(err)
}
}()
Expand All @@ -105,7 +107,7 @@ func ServeCommand(cdc *codec.Codec) *cobra.Command {
logger.Info("REST server started")

// wait forever and cleanup
cmn.TrapSignal(func() {
server.TrapSignal(func() {
defer cleanupFunc()
err := listener.Close()
logger.Error("error closing listener", "err", err)
Expand Down
4 changes: 2 additions & 2 deletions client/lcd/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,12 @@ func startTM(
//
// NOTE: This causes the thread to block.
func startLCD(logger log.Logger, listenAddr string, cdc *codec.Codec) (net.Listener, error) {
listener, err := tmrpc.Listen(listenAddr, tmrpc.Config{})
listener, err := tmrpc.Listen(listenAddr, &tmrpc.Config{})
if err != nil {
return nil, err
}

go tmrpc.StartHTTPServer(listener, createHandler(cdc), logger)
go tmrpc.StartHTTPServer(listener, createHandler(cdc), logger, &tmrpc.Config{})
return listener, nil
}

Expand Down
3 changes: 2 additions & 1 deletion server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ func startStandAlone(ctx *Context, appCreator AppCreator) error {
}

// wait forever
cmn.TrapSignal(func() {
cmn.TrapSignal(ctx.Logger, func() {
// cleanup
err = svr.Stop()
if err != nil {
cmn.Exit(err.Error())
}
})
select {}
return nil
}

Expand Down