mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
fix bug of null baseFee (#73)
* fix bug of null baseFee * Update l2trace_block.go * Update l2trace_block.go Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
This commit is contained in:
parent
33fcd2bf6d
commit
b714e22893
1 changed files with 9 additions and 1 deletions
|
|
@ -41,12 +41,20 @@ func NewTraceBlock(config *params.ChainConfig, block *Block, coinbase *AccountPr
|
|||
for i, tx := range block.Transactions() {
|
||||
txs[i] = newTraceTransaction(tx, block.NumberU64(), config)
|
||||
}
|
||||
|
||||
baseFee := block.BaseFee()
|
||||
// due to the special logic of `baseFee`, if `baseFee` is a nil
|
||||
// we would like to use new(big.Int) to replace it so that `baseFee.String()` would return "0"
|
||||
if baseFee == nil {
|
||||
baseFee = new(big.Int)
|
||||
}
|
||||
|
||||
return &BlockTrace{
|
||||
Number: block.Number().String(),
|
||||
Hash: block.Hash(),
|
||||
GasLimit: block.GasLimit(),
|
||||
Difficulty: block.Difficulty().String(),
|
||||
BaseFee: block.BaseFee().String(),
|
||||
BaseFee: baseFee.String(),
|
||||
Coinbase: coinbase,
|
||||
Time: block.Time(),
|
||||
Transactions: txs,
|
||||
|
|
|
|||
Loading…
Reference in a new issue