Quick fix for eth_feeHistory when reward is nil (#975)

* Quick fix for eth_feeHistory when reward is nil

`RPC method eth_feeHistory crashed: runtime error: invalid memory address or nil pointer dereference`
from caa1c5a6c6/rpc/ethereum/backend/feebackend.go (L29)

* Update CHANGELOG.md
This commit is contained in:
Loredana Cirstea 2022-03-06 15:39:48 +02:00 committed by GitHub
parent caa1c5a6c6
commit 805b2eada5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes
* (rpc) [\#529](https://github.com/tharsis/ethermint/pull/975) Fix unexpected `nil` values for `reward`, returned by `EffectiveGasTipValue(blockBaseFee)` in the `eth_feeHistory` RPC method.
* (evm) [\#529](https://github.com/tharsis/ethermint/issues/529) Add support return value on trace tx response.
* (rpc) [#970] (https://github.com/tharsis/ethermint/pull/970) Fix unexpected nil reward values on `eth_feeHistory` response

View File

@ -87,6 +87,9 @@ func (e *EVMBackend) processBlock(
}
tx := ethMsg.AsTransaction()
reward := tx.EffectiveGasTipValue(blockBaseFee)
if reward == nil {
reward = big.NewInt(0)
}
sorter[i] = txGasAndReward{gasUsed: txGasUsed, reward: reward}
break
}