Skip to content

Commit

Permalink
make gas fee event do not lost precision (#1401)
Browse files Browse the repository at this point in the history
* make gas fee event do not lost precision

* fix
  • Loading branch information
laizy authored Mar 30, 2022
1 parent 3b47282 commit 3035f5f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions smartcontract/service/evm/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ontio/ontology/common/constants"
"github.com/ontio/ontology/smartcontract/service/evm/types"
"github.com/ontio/ontology/vm/evm"
"github.com/ontio/ontology/vm/evm/params"
Expand Down Expand Up @@ -186,6 +187,9 @@ func (st *StateTransition) buyGas() (adjustedGas bool) {
if have, want := st.state.GetBalance(st.msg.From()), mgval; have.Cmp(want) < 0 {
mgval = have
gas = big.NewInt(0).Div(have, st.gasPrice).Uint64()
if st.evm.ChainConfig().ChainID.Uint64() != constants.EIP155_CHAINID_MAINNET || st.evm.Context.BlockNumber.Uint64() >= 14100000 {
mgval = big.NewInt(0).Mul(big.NewInt(0).SetUint64(gas), st.gasPrice)
}
adjustedGas = true
}

Expand Down

0 comments on commit 3035f5f

Please sign in to comment.