From 8e58c564c01556556d57de425ad4ba36792c479a Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Mon, 10 Jan 2022 11:52:52 -0800 Subject: [PATCH] rpc: collapse Caller and HTTPClient interfaces. (#7548) These two interfaces are identical, and besides HTTPClient being confusingly named, all but one location uses Caller. Update that one location, and drop the redundant interface. --- rpc/jsonrpc/client/http_json_client.go | 8 -------- rpc/jsonrpc/jsonrpc_test.go | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/rpc/jsonrpc/client/http_json_client.go b/rpc/jsonrpc/client/http_json_client.go index 45f516f04..029ec3b34 100644 --- a/rpc/jsonrpc/client/http_json_client.go +++ b/rpc/jsonrpc/client/http_json_client.go @@ -106,12 +106,6 @@ func (u parsedURL) GetTrimmedURL() string { //------------------------------------------------------------- -// HTTPClient is a common interface for JSON-RPC HTTP clients. -type HTTPClient interface { - // Call calls the given method with the params and returns a result. - Call(ctx context.Context, method string, params map[string]interface{}, result interface{}) (interface{}, error) -} - // Caller implementers can facilitate calling the JSON-RPC endpoint. type Caller interface { Call(ctx context.Context, method string, params map[string]interface{}, result interface{}) (interface{}, error) @@ -134,8 +128,6 @@ type Client struct { nextReqID int } -var _ HTTPClient = (*Client)(nil) - // Both Client and RequestBatch can facilitate calls to the JSON // RPC endpoint. var _ Caller = (*Client)(nil) diff --git a/rpc/jsonrpc/jsonrpc_test.go b/rpc/jsonrpc/jsonrpc_test.go index 3e1fbded1..b22dfa3d7 100644 --- a/rpc/jsonrpc/jsonrpc_test.go +++ b/rpc/jsonrpc/jsonrpc_test.go @@ -187,7 +187,7 @@ func echoDataBytesViaHTTP(ctx context.Context, cl client.Caller, bytes tmbytes.H return result.Value, nil } -func testWithHTTPClient(ctx context.Context, t *testing.T, cl client.HTTPClient) { +func testWithHTTPClient(ctx context.Context, t *testing.T, cl client.Caller) { val := testVal got, err := echoViaHTTP(ctx, cl, val) require.NoError(t, err)