MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / JSONRPCProcessBatchReply

Function JSONRPCProcessBatchReply

src/rpc/request.cpp:144–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144std::vector<UniValue> JSONRPCProcessBatchReply(const UniValue &in) {
145 if (!in.isArray()) {
146 throw std::runtime_error("Batch must be an array");
147 }
148 const size_t num{in.size()};
149 std::vector<UniValue> batch(num);
150 for (const UniValue &rec : in.getValues()) {
151 if (!rec.isObject()) {
152 throw std::runtime_error("Batch member must be an object");
153 }
154 size_t id = rec["id"].getInt<int>();
155 if (id >= num) {
156 throw std::runtime_error(
157 "Batch member id is larger than batch size");
158 }
159 batch[id] = rec;
160 }
161 return batch;
162}
163
164void JSONRPCRequest::parse(const UniValue &valRequest) {
165 // Parse request

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