From fa0cc274009670209fd71b1462dcdde3b431d64f Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 29 Nov 2016 13:59:00 +0100 Subject: [PATCH] ethclient: use package hexutil for number encoding --- ethclient/ethclient.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 8a25678d88..b23e9baa3e 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -112,7 +112,7 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface for i := range reqs { reqs[i] = rpc.BatchElem{ Method: "eth_getUncleByBlockHashAndIndex", - Args: []interface{}{body.Hash, fmt.Sprintf("%#x", i)}, + Args: []interface{}{body.Hash, hexutil.EncodeUint64(uint64(i))}, Result: &uncles[i], } } @@ -196,7 +196,7 @@ func toBlockNumArg(number *big.Int) string { if number == nil { return "latest" } - return fmt.Sprintf("%#x", number) + return hexutil.EncodeBig(number) } type rpcProgress struct {