From 46e4fe4d82986b4b3b8e7dbc0524d5489ba22173 Mon Sep 17 00:00:00 2001 From: lmittmann Date: Sun, 6 Jan 2019 18:12:23 +0100 Subject: [PATCH] fixing import cycle --- common/format.go | 6 ++---- common/format_test.go | 12 ------------ 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/common/format.go b/common/format.go index cf2efc0ba4..737f5f2763 100644 --- a/common/format.go +++ b/common/format.go @@ -22,8 +22,6 @@ import ( "regexp" "strings" "time" - - "github.com/ethereum/go-ethereum/params" ) // PrettyDuration is a pretty printed version of a time.Duration value that cuts @@ -86,12 +84,12 @@ func (t PrettyAge) String() string { // ToGWei converts the big.Int wei to its gwei string representation. func ToGWei(wei *big.Int) string { - return ToEth(new(big.Int).Mul(wei, big.NewInt(params.GWei))) + return ToEth(new(big.Int).Mul(wei, big.NewInt(1e9))) } // ToEth converts the big.Int wei to its ether string representation. func ToEth(wei *big.Int) string { - z, m := new(big.Int).DivMod(wei, big.NewInt(params.Ether), new(big.Int)) + z, m := new(big.Int).DivMod(wei, big.NewInt(1e18), new(big.Int)) if m.Cmp(new(big.Int)) == 0 { return z.String() } diff --git a/common/format_test.go b/common/format_test.go index 41a311321f..056a04a6f2 100644 --- a/common/format_test.go +++ b/common/format_test.go @@ -52,15 +52,3 @@ func TestToEth(t *testing.T) { } } } - -func BenchmarkToEth(b *testing.B) { - for n := 0; n < b.N; n++ { - ToEth(big.NewInt(1)) - } -} - -func BenchmarkToEth2(b *testing.B) { - for n := 0; n < b.N; n++ { - ToEth(big.NewInt(1000000000000000000)) - } -}