diff --git a/baseabci/baseapp.go b/baseabci/baseapp.go index 9e4d632..f1e3655 100644 --- a/baseabci/baseapp.go +++ b/baseabci/baseapp.go @@ -741,7 +741,7 @@ func (app *BaseApp) runTxStd(ctx ctx.Context, tx *txs.TxStd, txStdFromChainID st app.Logger.Error("exsits cross txqcp, but signer is nil.if you forgot to set up signer?") } - if crossTxQcp != nil { + if crossTxQcp != nil && crossTxQcp.TxStd != nil { txQcp := saveCrossChainResult(runCtx, crossTxQcp, false, app.txQcpSigner) result.Events = result.Events.AppendEvents(types.Events{ types.NewEvent( @@ -793,6 +793,7 @@ func saveCrossChainResult(ctx ctx.Context, crossTxQcp *txs.TxQcp, isResult bool, //deliverTxQcp: devilerTx阶段对TxQcp进行业务处理 func (app *BaseApp) deliverTxQcp(ctx ctx.Context, tx *txs.TxQcp) (result types.Result) { + defer func() { if r := recover(); r != nil { log := fmt.Sprintf("deliverTxQcp recovered: %v\nstack:\n%v", r, string(debug.Stack())) @@ -821,7 +822,7 @@ func (app *BaseApp) deliverTxQcp(ctx ctx.Context, tx *txs.TxQcp) (result types.R if !tx.IsResult { //类型为TxQcp时,将所有结果进行保存 txQcpResult := txs.NewQcpTxResult(result, tx.Sequence, tx.Extends, "") - txStd := txs.NewTxStd(txQcpResult, tx.From, types.ZeroInt()) + txStd := txs.NewTxStd(txQcpResult, tx.From, txs.QCP_RESULT_DEFAULT_MAX_GAS) crossTxQcp := &txs.TxQcp{ TxStd: txStd, diff --git a/context/context.go b/context/context.go index f9e8a8e..1e8f3f4 100644 --- a/context/context.go +++ b/context/context.go @@ -320,7 +320,9 @@ func (c Context) WithEventManager(em *types.EventManager) Context { return c.WithValue(contextKeyEventManager, em) } -func (c Context) EventManager() *types.EventManager { return c.Value(contextKeyEventManager).(*types.EventManager) } +func (c Context) EventManager() *types.EventManager { + return c.Value(contextKeyEventManager).(*types.EventManager) +} // Cache the multistore and return a new cached context. The cached context is // written to the context when writeCache is called. diff --git a/txs/qcpresult.go b/txs/qcpresult.go index 42b24d1..0c3a66a 100644 --- a/txs/qcpresult.go +++ b/txs/qcpresult.go @@ -10,6 +10,8 @@ import ( tcommon "github.com/tendermint/tendermint/libs/common" ) +var QCP_RESULT_DEFAULT_MAX_GAS = types.NewInt(200000) + // qos端对TxQcp的执行结果 type QcpTxResult struct { Result types.Result `json:"result"` //对应TxQcp执行结果 @@ -85,7 +87,7 @@ func (tx *QcpTxResult) GetGasPayer() types.Address { func (tx *QcpTxResult) GetSignData() []byte { ret := types.Int2Byte(int64(tx.Result.Code)) ret = append(ret, tx.Result.Data...) - for _, event := range tx.Result.Events{ + for _, event := range tx.Result.Events { ret = append(ret, []byte(event.Type)...) ret = append(ret, []byte(Extends2Byte(event.Attributes))...) }