eth/tracers: fix a bug in prestateTracer (#25884)

This commit is contained in:
Delweng 2022-09-28 23:52:39 +08:00 committed by GitHub
parent 2b1299b1c0
commit 85aafcfb2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,7 +79,7 @@ func (t *prestateTracer) CaptureStart(env *vm.EVM, from common.Address, to commo
// The sender balance is after reducing: value and gasLimit. // The sender balance is after reducing: value and gasLimit.
// We need to re-add them to get the pre-tx balance. // We need to re-add them to get the pre-tx balance.
fromBal := t.prestate[from].Balance fromBal := new(big.Int).Set(t.prestate[from].Balance)
gasPrice := env.TxContext.GasPrice gasPrice := env.TxContext.GasPrice
consumedGas := new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(t.gasLimit)) consumedGas := new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(t.gasLimit))
fromBal.Add(fromBal, new(big.Int).Add(value, consumedGas)) fromBal.Add(fromBal, new(big.Int).Add(value, consumedGas))