mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
zero division fix
This commit is contained in:
parent
3eeae7c1c3
commit
c698290536
1 changed files with 3 additions and 0 deletions
|
|
@ -44,6 +44,9 @@ func (st *insertStats) report(chain []*types.Block, index int, snapDiffItems, sn
|
||||||
var (
|
var (
|
||||||
now = mclock.Now()
|
now = mclock.Now()
|
||||||
elapsed = now.Sub(st.startTime)
|
elapsed = now.Sub(st.startTime)
|
||||||
|
if elapsed == 0 { // prevent zero division
|
||||||
|
elapsed = 1
|
||||||
|
}
|
||||||
mgasps = float64(st.usedGas) * 1000 / float64(elapsed)
|
mgasps = float64(st.usedGas) * 1000 / float64(elapsed)
|
||||||
)
|
)
|
||||||
// Update the Mgas per second gauge
|
// Update the Mgas per second gauge
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue