Skip to content

Commit

Permalink
Update core/gaspool.go
Browse files Browse the repository at this point in the history
Co-authored-by: Inphi <mlaw2501@gmail.com>
  • Loading branch information
roberto-bayardo and Inphi committed Mar 17, 2023
1 parent 9c9dd5f commit beaf391
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
statedb.SetTxContext(tx.Hash(), txIndex)

var (
txContext = core.NewEVMTxContext(msg)
snapshot = statedb.Snapshot()
prevGas = gaspool.Gas()
txContext = core.NewEVMTxContext(msg)
snapshot = statedb.Snapshot()
prevGas = gaspool.Gas()
prevDataGas = gaspool.DataGas()
)
evm := vm.NewEVM(vmContext, txContext, statedb, chainConfig, vmConfig)

Expand All @@ -201,6 +202,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
log.Info("rejected tx", "index", i, "hash", tx.Hash(), "from", msg.From, "error", err)
rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()})
gaspool.SetGas(prevGas)
gaspool.SetDataGas(prevDataGas)
continue
}
includedTxs = append(includedTxs, tx)
Expand Down
2 changes: 1 addition & 1 deletion core/gaspool.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (gp *GasPool) SetGas(gas uint64) {
gp.gas = gas
}

// SetGas sets the amount of data gas with the provided number.
// SetDataGas sets the amount of data gas with the provided number.
func (gp *GasPool) SetDataGas(dataGas uint64) {
gp.dataGas = dataGas
}
Expand Down

0 comments on commit beaf391

Please sign in to comment.