Commit 56becf19 authored by hezhengjun's avatar hezhengjun Committed by 33cn

correct the gasLimit processing mechanism

parent fc1057d4
...@@ -209,20 +209,19 @@ func (evm *EVMExecutor) GetMessage(tx *types.Transaction, index int, fromPtr *co ...@@ -209,20 +209,19 @@ func (evm *EVMExecutor) GetMessage(tx *types.Transaction, index int, fromPtr *co
return msg, types.ErrInvalidAddress return msg, types.ErrInvalidAddress
} }
gasLimit := action.GasLimit
gasPrice := action.GasPrice gasPrice := action.GasPrice
if gasLimit == 0 { //gasLimit 直接从交易费1:1转化而来,忽略action.GasLimit
gasLimit = uint64(evm.GetTxFee(tx, index)) gasLimit := uint64(evm.GetTxFee(tx, index))
//如果未设置交易费,则尝试读取免交易费联盟链模式下的gas设置 //如果未设置交易费,则尝试读取免交易费联盟链模式下的gas设置
if 0 == gasLimit { if 0 == gasLimit {
cfg := evm.GetAPI().GetConfig() cfg := evm.GetAPI().GetConfig()
conf := types.ConfSub(cfg, evmtypes.ExecutorName) conf := types.ConfSub(cfg, evmtypes.ExecutorName)
gasLimit = uint64(conf.GInt("evmGasLimit")) gasLimit = uint64(conf.GInt("evmGasLimit"))
if 0 == gasLimit { if 0 == gasLimit {
panic("evmGasLimit is not configured for permission blockchain") return nil, model.ErrNoGasConfigured
}
} }
} }
if gasPrice == 0 { if gasPrice == 0 {
gasPrice = uint32(1) gasPrice = uint32(1)
} }
......
...@@ -52,4 +52,6 @@ var ( ...@@ -52,4 +52,6 @@ var (
ErrInvalidJump = errors.New("invalid jump destination") ErrInvalidJump = errors.New("invalid jump destination")
// ErrInvalidRetsub invalid retsub // ErrInvalidRetsub invalid retsub
ErrInvalidRetsub = errors.New("invalid retsub") ErrInvalidRetsub = errors.New("invalid retsub")
// 没有配置gas
ErrNoGasConfigured = errors.New("ErrNoGasConfigured")
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment