MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / JSONRPCProcessBatchReply

Function JSONRPCProcessBatchReply

src/rpc/request.cpp:176–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176std::vector<UniValue> JSONRPCProcessBatchReply(const UniValue& in)
177{
178 if (!in.isArray()) {
179 throw std::runtime_error("Batch must be an array");
180 }
181 const size_t num {in.size()};
182 std::vector<UniValue> batch(num);
183 for (const UniValue& rec : in.getValues()) {
184 if (!rec.isObject()) {
185 throw std::runtime_error("Batch member must be an object");
186 }
187 size_t id = rec["id"].getInt<int>();
188 if (id >= num) {
189 throw std::runtime_error("Batch member id is larger than batch size");
190 }
191 batch[id] = rec;
192 }
193 return batch;
194}
195
196void JSONRPCRequest::parse(const UniValue& valRequest)
197{

Callers 2

ProcessReplyMethod · 0.85
ProcessReplyMethod · 0.85

Calls 3

isArrayMethod · 0.80
isObjectMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected