Skip to content

Commit

Permalink
Quick fix for eth_feeHistory when reward is nil (evmos#975)
Browse files Browse the repository at this point in the history
* Quick fix for eth_feeHistory when reward is nil

`RPC method eth_feeHistory crashed: runtime error: invalid memory address or nil pointer dereference`
from https://github.com/tharsis/ethermint/blob/caa1c5a6c6b7ed8ba4aaf6e0b0848f6be5ba6668/rpc/ethereum/backend/feebackend.go#L29

* Update CHANGELOG.md
  • Loading branch information
loredanacirstea authored and yihuang committed Mar 24, 2022
1 parent a50901f commit acc87bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

## Unreleased

### Bug Fixes

* (rpc) [#970] (https://github.com/tharsis/ethermint/pull/970) Fix unexpected nil reward values on `eth_feeHistory` response

### API Breaking

* (ante) [\#866](https://github.com/tharsis/ethermint/pull/866) `NewAnteHandler` constructor now receives a `HandlerOptions` field.
Expand Down
3 changes: 3 additions & 0 deletions rpc/ethereum/backend/feebackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit acc87bf

Please sign in to comment.