MCPcopy Create free account
hub / github.com/ethstorage/es-node / fmtGwei

Function fmtGwei

ethstorage/miner/utils.go:160–170  ·  view source on GitHub ↗
(gasPrice *big.Int)

Source from the content-addressed store, hash-verified

158}
159
160func fmtGwei(gasPrice *big.Int) string {
161 // if gasPrice lower than 1 Gwei, show in decimal
162 if gasPrice.Cmp(big.NewInt(params.GWei)) < 0 {
163 f := new(big.Float).SetPrec(236)
164 f.SetMode(big.ToNearestEven)
165 f.Quo(f.SetInt(gasPrice), big.NewFloat(params.GWei))
166 return fmt.Sprintf("%.9f", f)
167 }
168 // otherwise show in integer
169 return fmt.Sprintf("%d", new(big.Int).Div(gasPrice, big.NewInt(params.GWei)))
170}

Callers 2

newWorkLoopMethod · 0.85
SubmitMinedResultMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected