Skip to content

Commit

Permalink
Fix crash during reorg for v2.0.0 (#590) (#593)
Browse files Browse the repository at this point in the history
* params: fix usage of IsXDCxDisable

* internal/ethapi: fix nil block in function DoCall during reorg

Co-authored-by: Daniel Liu <139250065@qq.com>
  • Loading branch information
2 people authored and wanwiset25 committed Jul 30, 2024
1 parent f39cfa0 commit af9b7e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
// this makes sure resources are cleaned up.
defer cancel()

block, err := b.BlockByHash(ctx, header.Hash())
block, err := b.BlockByNumberOrHash(ctx, blockNrOrHash)
if err != nil {
return nil, 0, false, err, nil
}
Expand Down
6 changes: 5 additions & 1 deletion params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,10 @@ func (c *ChainConfig) IsTIPXDCXReceiver(num *big.Int) bool {
return isForked(common.TIPXDCX, num) && !isForked(common.TIPXDCXReceiverDisable, num)
}

func (c *ChainConfig) IsXDCxDisable(num *big.Int) bool {
return isForked(common.TIPXDCXReceiverDisable, num)
}

func (c *ChainConfig) IsTIPXDCXLending(num *big.Int) bool {
return isForked(common.TIPXDCXLending, num)
}
Expand Down Expand Up @@ -789,7 +793,7 @@ func (c *ChainConfig) Rules(num *big.Int) Rules {
IsLondon: c.IsLondon(num),
IsMerge: c.IsMerge(num),
IsShanghai: c.IsShanghai(num),
IsXDCxDisable: c.IsTIPXDCXReceiver(num),
IsXDCxDisable: c.IsXDCxDisable(num),
IsEIP1559: c.IsEIP1559(num),
}
}

0 comments on commit af9b7e3

Please sign in to comment.