Skip to content

Commit 23c32a9

Browse files
laanwjjonasschnelli
authored andcommitted
rpc: Change JSONRPCRequest to JSONRPCRequestObj
This is more consistent with `JSONRPCReplyObj`.
1 parent d736a6e commit 23c32a9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/bitcoin-cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
223223
evhttp_add_header(output_headers, "Authorization", (std::string("Basic ") + EncodeBase64(strRPCUserColonPass)).c_str());
224224

225225
// Attach request data
226-
std::string strRequest = JSONRPCRequest(strMethod, params, 1);
226+
std::string strRequest = JSONRPCRequestObj(strMethod, params, 1).write() + "\n";
227227
struct evbuffer * output_buffer = evhttp_request_get_output_buffer(req);
228228
assert(output_buffer);
229229
evbuffer_add(output_buffer, strRequest.data(), strRequest.size());

src/rpc/protocol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ using namespace std;
2626
* 1.2 spec: http://jsonrpc.org/historical/json-rpc-over-http.html
2727
*/
2828

29-
string JSONRPCRequest(const string& strMethod, const UniValue& params, const UniValue& id)
29+
UniValue JSONRPCRequestObj(const string& strMethod, const UniValue& params, const UniValue& id)
3030
{
3131
UniValue request(UniValue::VOBJ);
3232
request.push_back(Pair("method", strMethod));
3333
request.push_back(Pair("params", params));
3434
request.push_back(Pair("id", id));
35-
return request.write() + "\n";
35+
return request;
3636
}
3737

3838
UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id)

src/rpc/protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ enum RPCErrorCode
7777
RPC_WALLET_ALREADY_UNLOCKED = -17, //!< Wallet is already unlocked
7878
};
7979

80-
std::string JSONRPCRequest(const std::string& strMethod, const UniValue& params, const UniValue& id);
80+
UniValue JSONRPCRequestObj(const std::string& strMethod, const UniValue& params, const UniValue& id);
8181
UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id);
8282
std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id);
8383
UniValue JSONRPCError(int code, const std::string& message);

0 commit comments

Comments
 (0)