rpc/client: drop Version from Options

It makes no sense at all, it's a JSON-RPC version.
This commit is contained in:
Roman Khimov 2020-04-29 18:17:18 +03:00
parent 19397ec4a8
commit 6d202ad4c5

View file

@ -34,7 +34,6 @@ type Client struct {
cli *http.Client cli *http.Client
endpoint *url.URL endpoint *url.URL
ctx context.Context ctx context.Context
version string
wifMu *sync.Mutex wifMu *sync.Mutex
wif *keys.WIF wif *keys.WIF
balancer request.BalanceGetter balancer request.BalanceGetter
@ -59,10 +58,6 @@ type Options struct {
CACert string CACert string
DialTimeout time.Duration DialTimeout time.Duration
RequestTimeout time.Duration RequestTimeout time.Duration
// Version is the version of the client that will be send
// along with the request body. If no version is specified
// the default version (currently 2.0) will be used.
Version string
} }
// cache stores cache values for the RPC client methods // cache stores cache values for the RPC client methods
@ -92,10 +87,6 @@ func New(ctx context.Context, endpoint string, opts Options) (*Client, error) {
opts.RequestTimeout = defaultRequestTimeout opts.RequestTimeout = defaultRequestTimeout
} }
if opts.Version == "" {
opts.Version = defaultClientVersion
}
httpClient := &http.Client{ httpClient := &http.Client{
Transport: &http.Transport{ Transport: &http.Transport{
DialContext: (&net.Dialer{ DialContext: (&net.Dialer{
@ -114,7 +105,6 @@ func New(ctx context.Context, endpoint string, opts Options) (*Client, error) {
cli: httpClient, cli: httpClient,
wifMu: new(sync.Mutex), wifMu: new(sync.Mutex),
endpoint: url, endpoint: url,
version: opts.Version,
} }
if opts.Balancer == nil { if opts.Balancer == nil {
opts.Balancer = cl opts.Balancer = cl
@ -172,7 +162,7 @@ func (c *Client) CalculateInputs(address string, asset util.Uint256, cost util.F
func (c *Client) performRequest(method string, p request.RawParams, v interface{}) error { func (c *Client) performRequest(method string, p request.RawParams, v interface{}) error {
var ( var (
r = request.Raw{ r = request.Raw{
JSONRPC: c.version, JSONRPC: request.JSONRPCVersion,
Method: method, Method: method,
RawParams: p.Values, RawParams: p.Values,
ID: 1, ID: 1,