Browse Source

Update util.go

master
yuriy0803 5 years ago committed by GitHub
parent
commit
b9732ec420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      util/util.go

3
util/util.go

@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/common/hexutil"
) )
var Ether = math.BigPow(10, 18) var Ether = math.BigPow(10, 18)
@ -35,7 +36,7 @@ func MakeTimestamp() int64 {
func GetTargetHex(diff int64) string { func GetTargetHex(diff int64) string {
difficulty := big.NewInt(diff) difficulty := big.NewInt(diff)
diff1 := new(big.Int).Div(pow256, difficulty) diff1 := new(big.Int).Div(pow256, difficulty)
return string(common.ToHex(diff1.Bytes())) return string(hexutil.Encode(diff1.Bytes()))
} }
func TargetHexToDiff(targetHex string) *big.Int { func TargetHexToDiff(targetHex string) *big.Int {

Loading…
Cancel
Save