diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f46c7b81..4bb64273e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Features ### Fixes +- [#5676](https://github.com/blockscout/blockscout/pull/5676) - Fix wrong miner address shown for post EIP-1559 block for clique network ### Chore - [#5674](https://github.com/blockscout/blockscout/pull/5674) - Disable token holder refreshing diff --git a/apps/indexer/lib/indexer/transform/blocks.ex b/apps/indexer/lib/indexer/transform/blocks.ex index 8b9915e2be..37a7487952 100644 --- a/apps/indexer/lib/indexer/transform/blocks.ex +++ b/apps/indexer/lib/indexer/transform/blocks.ex @@ -35,9 +35,8 @@ defmodule Indexer.Transform.Blocks do recover_pub_key(signature_hash, decode(signature)) end - # Signature hash calculated from the block header. - # Needed for PoA-based chains - defp signature_hash(block) do + # Get EIP-1559 compatible block header + defp get_header_data(block) do header_data = [ decode(block.parent_hash), decode(block.sha3_uncles), @@ -56,6 +55,19 @@ defmodule Indexer.Transform.Blocks do decode(block.nonce) ] + if Map.has_key?(block, :base_fee_per_gas) do + # credo:disable-for-next-line + header_data ++ [block.base_fee_per_gas] + else + header_data + end + end + + # Signature hash calculated from the block header. + # Needed for PoA-based chains + defp signature_hash(block) do + header_data = get_header_data(block) + ExKeccak.hash_256(ExRLP.encode(header_data)) end