2018-02-14 08:16:06 -08:00
|
|
|
package baseapp
|
|
|
|
|
|
|
|
import (
|
2018-06-28 17:54:47 -07:00
|
|
|
"github.com/tendermint/tendermint/abci/server"
|
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
2018-07-02 13:34:06 -07:00
|
|
|
cmn "github.com/tendermint/tendermint/libs/common"
|
2018-12-10 06:27:25 -08:00
|
|
|
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2018-02-14 08:16:06 -08:00
|
|
|
)
|
|
|
|
|
2018-06-26 18:53:41 -07:00
|
|
|
// nolint - Mostly for testing
|
|
|
|
func (app *BaseApp) Check(tx sdk.Tx) (result sdk.Result) {
|
|
|
|
return app.runTx(runTxModeCheck, nil, tx)
|
|
|
|
}
|
|
|
|
|
|
|
|
// nolint - full tx execution
|
|
|
|
func (app *BaseApp) Simulate(tx sdk.Tx) (result sdk.Result) {
|
|
|
|
return app.runTx(runTxModeSimulate, nil, tx)
|
|
|
|
}
|
|
|
|
|
|
|
|
// nolint
|
|
|
|
func (app *BaseApp) Deliver(tx sdk.Tx) (result sdk.Result) {
|
|
|
|
return app.runTx(runTxModeDeliver, nil, tx)
|
|
|
|
}
|
|
|
|
|
2018-02-14 08:16:06 -08:00
|
|
|
// RunForever - BasecoinApp execution and cleanup
|
|
|
|
func RunForever(app abci.Application) {
|
|
|
|
|
|
|
|
// Start the ABCI server
|
2018-06-13 15:13:51 -07:00
|
|
|
srv, err := server.NewServer("0.0.0.0:26658", "socket", app)
|
2018-02-14 08:16:06 -08:00
|
|
|
if err != nil {
|
|
|
|
cmn.Exit(err.Error())
|
2018-06-28 15:52:10 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
err = srv.Start()
|
|
|
|
if err != nil {
|
|
|
|
cmn.Exit(err.Error())
|
|
|
|
return
|
2018-02-14 08:16:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Wait forever
|
|
|
|
cmn.TrapSignal(func() {
|
|
|
|
// Cleanup
|
2018-06-28 15:52:10 -07:00
|
|
|
err := srv.Stop()
|
|
|
|
if err != nil {
|
|
|
|
cmn.Exit(err.Error())
|
|
|
|
}
|
2018-02-14 08:16:06 -08:00
|
|
|
})
|
|
|
|
}
|