|
|
|
@ -498,6 +498,33 @@ RPCHelpMan::RPCHelpMan(std::string name, std::string description, std::vector<RP
|
|
|
|
|
for (const std::string& name : names) {
|
|
|
|
|
CHECK_NONFATAL(named_args.insert(name).second);
|
|
|
|
|
}
|
|
|
|
|
// Default value type should match argument type only when defined
|
|
|
|
|
if (arg.m_fallback.index() == 2) {
|
|
|
|
|
const RPCArg::Type type = arg.m_type;
|
|
|
|
|
switch (std::get<RPCArg::Default>(arg.m_fallback).getType()) {
|
|
|
|
|
case UniValue::VOBJ:
|
|
|
|
|
CHECK_NONFATAL(type == RPCArg::Type::OBJ);
|
|
|
|
|
break;
|
|
|
|
|
case UniValue::VARR:
|
|
|
|
|
CHECK_NONFATAL(type == RPCArg::Type::ARR);
|
|
|
|
|
break;
|
|
|
|
|
case UniValue::VSTR:
|
|
|
|
|
CHECK_NONFATAL(type == RPCArg::Type::STR || type == RPCArg::Type::STR_HEX || type == RPCArg::Type::AMOUNT);
|
|
|
|
|
break;
|
|
|
|
|
case UniValue::VNUM:
|
|
|
|
|
CHECK_NONFATAL(type == RPCArg::Type::NUM || type == RPCArg::Type::AMOUNT || type == RPCArg::Type::RANGE);
|
|
|
|
|
break;
|
|
|
|
|
case UniValue::VBOOL:
|
|
|
|
|
CHECK_NONFATAL(type == RPCArg::Type::BOOL);
|
|
|
|
|
break;
|
|
|
|
|
case UniValue::VNULL:
|
|
|
|
|
// Null values are accepted in all arguments
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
CHECK_NONFATAL(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|