common/json_filter: routine to turn "filter" JSON into a filter.

Since the "struct command" is different from plugins and lightningd, we
need an accessor for this to work (the plugin one is a dummy for now!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-11-04 14:00:48 +10:30
parent 3c75770586
commit 508a170598
6 changed files with 84 additions and 0 deletions

View File

@@ -15,6 +15,9 @@ struct command_result *command_fail(struct command *cmd, enum jsonrpc_errcode co
const char *fmt, ...)
PRINTF_FMT(3, 4) WARN_UNUSED_RESULT RETURNS_NONNULL;
/* Caller supplies this too: must provide this to reach into cmd */
struct json_filter **command_filter_ptr(struct command *cmd);
/* Convenient wrapper for "paramname: msg: invalid token '.*%s'" */
static inline struct command_result *
command_fail_badparam(struct command *cmd,