Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit be459ef

Browse files
authored
Fix division by zero (#125)
1 parent 45e865e commit be459ef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

miner/environment_diff.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,13 @@ func (envDiff *environmentDiff) commitSBundle(b *types.SimSBundle, chData chainD
270270
return errors.New("coinbase balance decreased")
271271
}
272272

273-
gotEGP := new(big.Int).Div(coinbaseDelta, gasDelta)
273+
var gotEGP *big.Int
274+
if gasDelta.Cmp(common.Big0) == 0 {
275+
gotEGP = new(big.Int).SetUint64(0)
276+
} else {
277+
gotEGP = new(big.Int).Div(coinbaseDelta, gasDelta)
278+
}
279+
274280
simEGP := new(big.Int).Set(b.MevGasPrice)
275281

276282
// allow > 1% difference

0 commit comments

Comments
 (0)