MCPcopy Create free account
hub / github.com/LUX-Core/lux / parseBlockHeight

Function parseBlockHeight

src/rpcwallet.cpp:204–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202}
203
204size_t parseBlockHeight(const UniValue& val) {
205 if (val.isStr()) {
206 auto blockKey = val.get_str();
207
208 if (blockKey == "latest") {
209 return latestblock.height;
210 } else {
211 throw JSONRPCError(RPC_INVALID_PARAMS, "invalid block number");
212 }
213 }
214
215 if (val.isNum()) {
216 int blockHeight = val.get_int();
217
218 if (blockHeight < 0) {
219 return latestblock.height;
220 }
221
222 return blockHeight;
223 }
224
225 throw JSONRPCError(RPC_INVALID_PARAMS, "invalid block number");
226}
227
228size_t parseBlockHeight(const UniValue& val, size_t defaultVal) {
229 if (val.isNull()) {

Callers 3

setFromBlockMethod · 0.85
setToBlockMethod · 0.85
WaitForLogsParamsMethod · 0.85

Calls 6

JSONRPCErrorFunction · 0.85
isStrMethod · 0.80
get_strMethod · 0.80
isNumMethod · 0.80
get_intMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected