Skip to content

Commit

Permalink
add default qcpresult maxgas
Browse files Browse the repository at this point in the history
  • Loading branch information
TokenxyWZY committed Sep 16, 2019
1 parent 6d44a5e commit af3670b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions baseabci/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()))
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion txs/qcpresult.go
Original file line number Diff line number Diff line change
Expand Up @@ -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执行结果
Expand Down Expand Up @@ -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))...)
}
Expand Down

0 comments on commit af3670b

Please sign in to comment.