Skip to content

Commit

Permalink
rpc: Removing category, description and verbose from json_comma…
Browse files Browse the repository at this point in the history
…nd struct

As suggested by @rustyrussell, removing redundant fields `category`, `description` and `verbose` from all rpc commands. These should be described in the documentation schema.

Changelog-None.
  • Loading branch information
ShahanaFarooqui committed Jul 23, 2024
1 parent ef0ca16 commit 24e0707
Show file tree
Hide file tree
Showing 37 changed files with 116 additions and 522 deletions.
3 changes: 0 additions & 3 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 3 additions & 30 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12567,35 +12567,14 @@
"type": "object",
"additionalProperties": true,
"required": [
"command",
"category",
"description",
"verbose"
"command"
],
"properties": {
"command": {
"type": "string",
"description": [
"The command."
]
},
"category": {
"type": "string",
"description": [
"The category for this command (useful for grouping)."
]
},
"description": {
"type": "string",
"description": [
"A one-line description of the purpose of this command."
]
},
"verbose": {
"type": "string",
"description": [
"A full description of this command (including whether it's deprecated)."
]
}
}
}
Expand Down Expand Up @@ -12635,10 +12614,7 @@
"response": {
"help": [
{
"command": "pay bolt11 [amount_msat] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee] [localinvreqid] [exclude] [maxfee] [description] [dev_use_shadow]",
"category": "plugin",
"description": "Send payment specified by {bolt11}",
"verbose": "Attempt to pay the {bolt11} invoice."
"command": "pay bolt11 [amount_msat] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee] [localinvreqid] [exclude] [maxfee] [description] [dev_use_shadow]"
}
],
"format-hint": "simple"
Expand All @@ -12655,10 +12631,7 @@
"response": {
"help": [
{
"command": "dev subcommand=crash|rhash|slowcmd",
"category": "developer",
"description": "Developer command test multiplexer",
"verbose": "dev rhash {secret}\n\tShow SHA256 of {secret}\ndev crash\n\tCrash lightningd by calling fatal()\ndev slowcmd {msec}\n\tTorture test for slow commands, optional {msec}\n"
"command": "dev subcommand=crash|rhash|slowcmd"
}
],
"format-hint": "simple"
Expand Down
216 changes: 108 additions & 108 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -2617,10 +2617,7 @@ def stop2py(m):

def help_help2py(m):
return remove_default({
"category": m.category, # PrimitiveField in generate_composite
"command": m.command, # PrimitiveField in generate_composite
"description": m.description, # PrimitiveField in generate_composite
"verbose": m.verbose, # PrimitiveField in generate_composite
})


Expand Down
33 changes: 3 additions & 30 deletions doc/schemas/lightning-help.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,14 @@
"type": "object",
"additionalProperties": true,
"required": [
"command",
"category",
"description",
"verbose"
"command"
],
"properties": {
"command": {
"type": "string",
"description": [
"The command."
]
},
"category": {
"type": "string",
"description": [
"The category for this command (useful for grouping)."
]
},
"description": {
"type": "string",
"description": [
"A one-line description of the purpose of this command."
]
},
"verbose": {
"type": "string",
"description": [
"A full description of this command (including whether it's deprecated)."
]
}
}
}
Expand Down Expand Up @@ -99,10 +78,7 @@
"response": {
"help": [
{
"command": "pay bolt11 [amount_msat] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee] [localinvreqid] [exclude] [maxfee] [description] [dev_use_shadow]",
"category": "plugin",
"description": "Send payment specified by {bolt11}",
"verbose": "Attempt to pay the {bolt11} invoice."
"command": "pay bolt11 [amount_msat] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee] [localinvreqid] [exclude] [maxfee] [description] [dev_use_shadow]"
}
],
"format-hint": "simple"
Expand All @@ -119,10 +95,7 @@
"response": {
"help": [
{
"command": "dev subcommand=crash|rhash|slowcmd",
"category": "developer",
"description": "Developer command test multiplexer",
"verbose": "dev rhash {secret}\n\tShow SHA256 of {secret}\ndev crash\n\tCrash lightningd by calling fatal()\ndev slowcmd {msec}\n\tTorture test for slow commands, optional {msec}\n"
"command": "dev subcommand=crash|rhash|slowcmd"
}
],
"format-hint": "simple"
Expand Down
4 changes: 0 additions & 4 deletions lightningd/chaintopology.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,7 @@ static struct command_result *json_feerates(struct command *cmd,

static const struct json_command feerates_command = {
"feerates",
"bitcoin",
json_feerates,
"Return feerate estimates, either satoshi-per-kw ({style} perkw) or satoshi-per-kb ({style} perkb)."
};
AUTODATA(json_command, &feerates_command);

Expand All @@ -782,9 +780,7 @@ static struct command_result *json_parse_feerate(struct command *cmd,

static const struct json_command parse_feerate_command = {
"parsefeerate",
"bitcoin",
json_parse_feerate,
"Return current feerate in perkw + perkb for given feerate string."
};
AUTODATA(json_command, &parse_feerate_command);

Expand Down
16 changes: 0 additions & 16 deletions lightningd/channel_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -2198,31 +2198,19 @@ static struct command_result *json_splice_signed(struct command *cmd,

static const struct json_command splice_init_command = {
"splice_init",
"channels",
json_splice_init,
"Init a channel splice to {channel_id} for {relative_amount} satoshis with {initialpsbt}. "
"Returns updated {psbt} with (partial) contributions from peer"
};
AUTODATA(json_command, &splice_init_command);

static const struct json_command splice_update_command = {
"splice_update",
"channels",
json_splice_update,
"Update {channel_id} currently active negotiated splice with {psbt}. "
""
"Returns updated {psbt} with (partial) contributions from peer. "
"If {commitments_secured} is true, next call may be to splicechannel_finalize, "
"otherwise keep calling splice_update passing back in the returned PSBT until "
"{commitments_secured} is true."
};
AUTODATA(json_command, &splice_update_command);

static const struct json_command splice_signed_command = {
"splice_signed",
"channels",
json_splice_signed,
"Send our {signed_psbt}'s tx sigs for {channel_id}."
};
AUTODATA(json_command, &splice_signed_command);

Expand Down Expand Up @@ -2274,9 +2262,7 @@ static struct command_result *json_dev_feerate(struct command *cmd,

static const struct json_command dev_feerate_command = {
"dev-feerate",
"developer",
json_dev_feerate,
"Set feerate for {id} to {feerate}",
.dev_only = true,
};
AUTODATA(json_command, &dev_feerate_command);
Expand Down Expand Up @@ -2331,9 +2317,7 @@ static struct command_result *json_dev_quiesce(struct command *cmd,

static const struct json_command dev_quiesce_command = {
"dev-quiesce",
"developer",
json_dev_quiesce,
"Initiate quiscence protocol with peer",
.dev_only = true,
};
AUTODATA(json_command, &dev_quiesce_command);
2 changes: 0 additions & 2 deletions lightningd/closed_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ static struct command_result *json_listclosedchannels(struct command *cmd,

static const struct json_command listclosedchannels_command = {
"listclosedchannels",
"network",
json_listclosedchannels,
"Show historical (dead) channels."
};
AUTODATA(json_command, &listclosedchannels_command);
5 changes: 0 additions & 5 deletions lightningd/closing_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,11 +896,6 @@ discard_unopened: {

static const struct json_command close_command = {
"close",
"channels",
json_close,
"Close the channel with {id} "
"(either peer ID, channel ID, or short channel ID). "
"Force a unilateral close after {unilateraltimeout} seconds (default 48h). "
"If {destination} address is provided, will be used as output address."
};
AUTODATA(json_command, &close_command);
8 changes: 0 additions & 8 deletions lightningd/configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,7 @@ static struct command_result *json_listconfigs(struct command *cmd,

static const struct json_command listconfigs_command = {
"listconfigs",
"utility",
json_listconfigs,
"List all configuration options, or with [config], just that one.",
.verbose = "listconfigs [config]\n"
"Outputs an object, with each field a config options\n"
"(Option names which start with # are comments)\n"
"With [config], object only has that field"
};
AUTODATA(json_command, &listconfigs_command);

Expand Down Expand Up @@ -639,8 +633,6 @@ static struct command_result *json_setconfig(struct command *cmd,

static const struct json_command setconfig_command = {
"setconfig",
"utility",
json_setconfig,
"Set a dynamically-adjustable config."
};
AUTODATA(json_command, &setconfig_command);
12 changes: 0 additions & 12 deletions lightningd/connect_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,7 @@ static struct command_result *json_connect(struct command *cmd,

static const struct json_command connect_command = {
"connect",
"network",
json_connect,
"Connect to {id} at {host} (which can end in ':port' if not default). "
"{id} can also be of the form id@host"
};
AUTODATA(json_command, &connect_command);

Expand Down Expand Up @@ -915,10 +912,7 @@ static struct command_result *json_sendcustommsg(struct command *cmd,

static const struct json_command sendcustommsg_command = {
"sendcustommsg",
"utility",
json_sendcustommsg,
"Send a custom message to the peer with the given {node_id}",
.verbose = "sendcustommsg node_id hexcustommsg",
};

AUTODATA(json_command, &sendcustommsg_command);
Expand All @@ -939,9 +933,7 @@ static struct command_result *json_dev_suppress_gossip(struct command *cmd,

static const struct json_command dev_suppress_gossip = {
"dev-suppress-gossip",
"developer",
json_dev_suppress_gossip,
"Stop this node from sending any more gossip.",
.dev_only = true,
};
AUTODATA(json_command, &dev_suppress_gossip);
Expand All @@ -962,9 +954,7 @@ static struct command_result *json_dev_report_fds(struct command *cmd,

static const struct json_command dev_report_fds = {
"dev-report-fds",
"developer",
json_dev_report_fds,
"Ask connectd to report status of all its open files.",
.dev_only = true,
};
AUTODATA(json_command, &dev_report_fds);
Expand All @@ -985,9 +975,7 @@ static struct command_result *json_dev_connectd_exhaust_fds(struct command *cmd,

static const struct json_command dev_connectd_exhaust_fds = {
"dev-connectd-exhaust-fds",
"developer",
json_dev_connectd_exhaust_fds,
"Make connectd run out of file descriptors",
.dev_only = true,
};
AUTODATA(json_command, &dev_connectd_exhaust_fds);
8 changes: 0 additions & 8 deletions lightningd/datastore.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,32 +345,24 @@ static struct command_result *json_datastoreusage(struct command *cmd,

static const struct json_command datastore_command = {
"datastore",
"utility",
json_datastore,
"Add a {key} and {hex}/{string} data to the data store",
};
AUTODATA(json_command, &datastore_command);

static const struct json_command deldatastore_command = {
"deldatastore",
"utility",
json_deldatastore,
"Remove a {key} from the data store",
};
AUTODATA(json_command, &deldatastore_command);

static const struct json_command listdatastore_command = {
"listdatastore",
"utility",
json_listdatastore,
"List the datastore, optionally only {key}",
};
AUTODATA(json_command, &listdatastore_command);

static const struct json_command datastoreusage_command = {
"datastoreusage",
"utility",
json_datastoreusage,
"List the datastore usage, starting from an optional {key}",
};
AUTODATA(json_command, &datastoreusage_command);
Loading

0 comments on commit 24e0707

Please sign in to comment.