ethclient: use package hexutil for number encoding

This commit is contained in:
Felix Lange 2016-11-29 13:59:00 +01:00
parent 4cb29bde2e
commit fa0cc27400

View File

@ -112,7 +112,7 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface
for i := range reqs { for i := range reqs {
reqs[i] = rpc.BatchElem{ reqs[i] = rpc.BatchElem{
Method: "eth_getUncleByBlockHashAndIndex", Method: "eth_getUncleByBlockHashAndIndex",
Args: []interface{}{body.Hash, fmt.Sprintf("%#x", i)}, Args: []interface{}{body.Hash, hexutil.EncodeUint64(uint64(i))},
Result: &uncles[i], Result: &uncles[i],
} }
} }
@ -196,7 +196,7 @@ func toBlockNumArg(number *big.Int) string {
if number == nil { if number == nil {
return "latest" return "latest"
} }
return fmt.Sprintf("%#x", number) return hexutil.EncodeBig(number)
} }
type rpcProgress struct { type rpcProgress struct {