mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-22 00:00:55 +01:00
Fix uninitialized URI in batch RPC requests
This fixes "Wallet file not specified" errors when making batch wallet RPC
calls with more than one wallet loaded. This issue was reported by
NicolasDorier <nicolas.dorier@gmail.com>
https://github.com/bitcoin/bitcoin/issues/11257
Request URI is not used for anything except multiwallet request dispatching, so
this change has no other effects.
Fixes #11257
Github-Pull: #11277
Rebased-From: edafc718ad
This commit is contained in:
committed by
MarcoFalke
parent
6372a75581
commit
70268454e8
@@ -192,7 +192,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
|
||||
|
||||
// array of requests
|
||||
} else if (valRequest.isArray())
|
||||
strReply = JSONRPCExecBatch(valRequest.get_array());
|
||||
strReply = JSONRPCExecBatch(jreq, valRequest.get_array());
|
||||
else
|
||||
throw JSONRPCError(RPC_PARSE_ERROR, "Top-level object parse error");
|
||||
|
||||
|
||||
@@ -387,11 +387,10 @@ void JSONRPCRequest::parse(const UniValue& valRequest)
|
||||
throw JSONRPCError(RPC_INVALID_REQUEST, "Params must be an array or object");
|
||||
}
|
||||
|
||||
static UniValue JSONRPCExecOne(const UniValue& req)
|
||||
static UniValue JSONRPCExecOne(JSONRPCRequest jreq, const UniValue& req)
|
||||
{
|
||||
UniValue rpc_result(UniValue::VOBJ);
|
||||
|
||||
JSONRPCRequest jreq;
|
||||
try {
|
||||
jreq.parse(req);
|
||||
|
||||
@@ -411,11 +410,11 @@ static UniValue JSONRPCExecOne(const UniValue& req)
|
||||
return rpc_result;
|
||||
}
|
||||
|
||||
std::string JSONRPCExecBatch(const UniValue& vReq)
|
||||
std::string JSONRPCExecBatch(const JSONRPCRequest& jreq, const UniValue& vReq)
|
||||
{
|
||||
UniValue ret(UniValue::VARR);
|
||||
for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++)
|
||||
ret.push_back(JSONRPCExecOne(vReq[reqIdx]));
|
||||
ret.push_back(JSONRPCExecOne(jreq, vReq[reqIdx]));
|
||||
|
||||
return ret.write() + "\n";
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ extern std::string HelpExampleRpc(const std::string& methodname, const std::stri
|
||||
bool StartRPC();
|
||||
void InterruptRPC();
|
||||
void StopRPC();
|
||||
std::string JSONRPCExecBatch(const UniValue& vReq);
|
||||
std::string JSONRPCExecBatch(const JSONRPCRequest& jreq, const UniValue& vReq);
|
||||
|
||||
// Retrieves any serialization flags requested in command line argument
|
||||
int RPCSerializationFlags();
|
||||
|
||||
Reference in New Issue
Block a user