Skip to content

Commit

Permalink
fix panic issue when ExcessDataGas is nil (ethereum#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-bayardo authored Oct 14, 2022
1 parent 91322eb commit 0a53f99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func NewEVMBlockContext(header *types.Header, excessDataGas *big.Int, chain Chai
beneficiary common.Address
baseFee *big.Int
random *common.Hash
edg *big.Int
)

// If we don't have an explicit author (i.e. not mining), extract from the header
Expand All @@ -59,8 +58,11 @@ func NewEVMBlockContext(header *types.Header, excessDataGas *big.Int, chain Chai
if header.Difficulty.Cmp(common.Big0) == 0 {
random = &header.MixDigest
}
// In the event excessDataGas is nil (which happens if the parent block is pre-sharding),
// we bootstrap BlockContext.ExcessDataGas with the zero value.
edg := new(big.Int)
if excessDataGas != nil {
edg = new(big.Int).Set(excessDataGas)
edg.Set(excessDataGas)
}
return vm.BlockContext{
CanTransfer: CanTransfer,
Expand Down

0 comments on commit 0a53f99

Please sign in to comment.