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

Function JSONRPCProcessBatchReply

src/rpc/protocol.cpp:135–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135std::vector<UniValue> JSONRPCProcessBatchReply(const UniValue &in, size_t num)
136{
137 if (!in.isArray()) {
138 throw std::runtime_error("Batch must be an array");
139 }
140 std::vector<UniValue> batch(num);
141 for (size_t i=0; i<in.size(); ++i) {
142 const UniValue &rec = in[i];
143 if (!rec.isObject()) {
144 throw std::runtime_error("Batch member must be object");
145 }
146 size_t id = rec["id"].get_int();
147 if (id >= num) {
148 throw std::runtime_error("Batch member id larger than size");
149 }
150 batch[id] = rec;
151 }
152 return batch;
153}

Callers 1

ProcessReplyMethod · 0.85

Calls 4

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

Tested by

no test coverage detected