rpc: Removing category and verbose from json_command struct

This commit is contained in:
ShahanaFarooqui
2024-07-23 14:19:47 -07:00
committed by Rusty Russell
parent 58e3ea574c
commit 89c182e2be
41 changed files with 125 additions and 361 deletions

View File

@@ -1389,15 +1389,12 @@ static const char *plugin_rpcmethod_add(struct plugin *plugin,
const char *buffer,
const jsmntok_t *meth)
{
const jsmntok_t *nametok, *categorytok, *desctok, *longdesctok,
*usagetok, *deprtok;
const jsmntok_t *nametok, *desctok, *usagetok, *deprtok;
struct json_command *cmd;
const char *usage, *err;
nametok = json_get_member(buffer, meth, "name");
categorytok = json_get_member(buffer, meth, "category");
desctok = json_get_member(buffer, meth, "description");
longdesctok = json_get_member(buffer, meth, "long_description");
usagetok = json_get_member(buffer, meth, "usage");
deprtok = json_get_member(buffer, meth, "deprecated");
@@ -1414,12 +1411,6 @@ static const char *plugin_rpcmethod_add(struct plugin *plugin,
meth->end - meth->start, buffer + meth->start);
}
if (longdesctok && longdesctok->type != JSMN_STRING) {
return tal_fmt(plugin,
"\"long_description\" is not a string: %.*s",
meth->end - meth->start, buffer + meth->start);
}
if (usagetok && usagetok->type != JSMN_STRING) {
return tal_fmt(plugin,
"\"usage\" is not a string: %.*s",
@@ -1428,15 +1419,7 @@ static const char *plugin_rpcmethod_add(struct plugin *plugin,
cmd = notleak(tal(plugin, struct json_command));
cmd->name = json_strdup(cmd, buffer, nametok);
if (categorytok)
cmd->category = json_strdup(cmd, buffer, categorytok);
else
cmd->category = "plugin";
cmd->description = json_strdup(cmd, buffer, desctok);
if (longdesctok)
cmd->verbose = json_strdup(cmd, buffer, longdesctok);
else
cmd->verbose = cmd->description;
if (usagetok)
usage = json_strdup(tmpctx, buffer, usagetok);
else