diff --git a/rpc/rpc.go b/rpc/rpc.go index 96137bb77..1a4237da5 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -12,7 +12,7 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/sammy007/open-ethereum-pool/util" ) @@ -177,7 +177,7 @@ func (r *RPCClient) GetBalance(address string) (*big.Int, error) { func (r *RPCClient) Sign(from string, s string) (string, error) { hash := sha256.Sum256([]byte(s)) - rpcResp, err := r.doPost(r.Url, "eth_sign", []string{from, common.ToHex(hash[:])}) + rpcResp, err := r.doPost(r.Url, "eth_sign", []string{from, hexutil.Encode(hash[:])}) var reply string if err != nil { return reply, err diff --git a/util/util.go b/util/util.go index b4219c52e..bfcd600a5 100644 --- a/util/util.go +++ b/util/util.go @@ -8,6 +8,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereum/go-ethereum/common/hexutil" + ) var Ether = math.BigPow(10, 18) @@ -35,7 +37,7 @@ func MakeTimestamp() int64 { func GetTargetHex(diff int64) string { difficulty := big.NewInt(diff) 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 {