param: generalize check handling a little.

We want to extend it to plugins, and we want it to be allowed to be async for more power,
so rather than not completing the cmd if we're checking, do it in command_check_done()
and call it.

This is cleaner than the special case we had before, and allows check to us all the
normal jsonrpc mechanisms, especially async requests (which we'll need if we want to
hand check requests to plugins!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2024-04-04 14:06:11 +10:30
parent e3c4bdf209
commit cf72fb418e
9 changed files with 41 additions and 33 deletions

View File

@@ -57,4 +57,9 @@ void command_set_usage(struct command *cmd, const char *usage);
/* Also caller supplied: is this invoked simply to check parameters? */
bool command_check_only(const struct command *cmd);
/* To return after param_check() succeeds but we're still
* command_check_only(cmd). */
struct command_result *command_check_done(struct command *cmd)
WARN_UNUSED_RESULT;
#endif /* LIGHTNING_COMMON_JSON_COMMAND_H */