MCPcopy Create free account
hub / github.com/ElementsProject/elements / JSONRPCProcessBatchReply

Function JSONRPCProcessBatchReply

src/rpc/request.cpp:183–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183std::vector<UniValue> JSONRPCProcessBatchReply(const UniValue& in)
184{
185 if (!in.isArray()) {
186 throw std::runtime_error("Batch must be an array");
187 }
188 const size_t num {in.size()};
189 std::vector<UniValue> batch(num);
190 for (const UniValue& rec : in.getValues()) {
191 if (!rec.isObject()) {
192 throw std::runtime_error("Batch member must be an object");
193 }
194 size_t id = rec["id"].get_int();
195 if (id >= num) {
196 throw std::runtime_error("Batch member id is larger than batch size");
197 }
198 batch[id] = rec;
199 }
200 return batch;
201}
202
203void JSONRPCRequest::parse(const UniValue& valRequest)
204{

Callers 2

ProcessReplyMethod · 0.85
ProcessReplyMethod · 0.85

Calls 4

isArrayMethod · 0.80
isObjectMethod · 0.80
get_intMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected