fix: web3 client doesn't expect a nil baseFeePerGas (#854)
Closes: #853 Solution: - only set baseFeePerGas when base fee is not nil. Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
parent
0777d0b670
commit
8bc3cc471b
@ -98,7 +98,7 @@ func FormatBlock(
|
||||
transactionsRoot = common.BytesToHash(header.DataHash)
|
||||
}
|
||||
|
||||
return map[string]interface{}{
|
||||
result := map[string]interface{}{
|
||||
"number": hexutil.Uint64(header.Height),
|
||||
"hash": hexutil.Bytes(header.Hash()),
|
||||
"parentHash": common.BytesToHash(header.LastBlockID.Hash.Bytes()),
|
||||
@ -116,12 +116,17 @@ func FormatBlock(
|
||||
"timestamp": hexutil.Uint64(header.Time.Unix()),
|
||||
"transactionsRoot": transactionsRoot,
|
||||
"receiptsRoot": ethtypes.EmptyRootHash,
|
||||
"baseFeePerGas": (*hexutil.Big)(baseFee),
|
||||
|
||||
"uncles": []common.Hash{},
|
||||
"transactions": transactions,
|
||||
"totalDifficulty": (*hexutil.Big)(big.NewInt(0)),
|
||||
}
|
||||
|
||||
if baseFee != nil {
|
||||
result["baseFeePerGas"] = (*hexutil.Big)(baseFee)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
type DataError interface {
|
||||
|
Loading…
Reference in New Issue
Block a user