From 677cd0016f8428b71698e4d4bf6cd9c5889a11de Mon Sep 17 00:00:00 2001 From: MengXiangJian <805442788@qq.com> Date: Tue, 16 Nov 2021 09:20:06 +0800 Subject: [PATCH] Merge PR: fix without gracefully exit (#1197) --- cmd/exchaind/main.go | 1 + x/evm/types/tracer.go | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/exchaind/main.go b/cmd/exchaind/main.go index bc5e5afd68..36735ef08e 100644 --- a/cmd/exchaind/main.go +++ b/cmd/exchaind/main.go @@ -109,6 +109,7 @@ func closeApp(iApp abci.Application) { app := iApp.(*app.OKExChainApp) app.StopStore() evmtypes.CloseIndexer() + evmtypes.CloseTracer() rpc.CloseEthBackend() } diff --git a/x/evm/types/tracer.go b/x/evm/types/tracer.go index 0f600ee0e4..bdb8deb5e0 100644 --- a/x/evm/types/tracer.go +++ b/x/evm/types/tracer.go @@ -11,7 +11,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/eth/tracers" json "github.com/json-iterator/go" - "github.com/okex/exchain/libs/cosmos-sdk/server" sdk "github.com/okex/exchain/libs/cosmos-sdk/types" tmtypes "github.com/okex/exchain/libs/tendermint/types" "github.com/spf13/viper" @@ -45,12 +44,10 @@ var ( evmLogConfig *vm.LogConfig ) -func init() { - server.TrapSignal(func() { - if tracesDB != nil { - tracesDB.Close() - } - }) +func CloseTracer() { + if tracesDB != nil { + tracesDB.Close() + } } func InitTxTraces() {