lightningd: --deprecated-api option to turn off deprecated APIs.

This can be used for upgrades to make sure you're not using deprecated
options, JSON commands, JSON fields, etc.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-01-17 06:13:14 +10:30
parent 5a06b665bd
commit 1f6392fa83
4 changed files with 17 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
#include <lightningd/jsonrpc.h>
#include <lightningd/lightningd.h>
#include <lightningd/log.h>
#include <lightningd/options.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -526,6 +527,13 @@ static void parse_request(struct json_connection *jcon, const jsmntok_t tok[])
jcon->buffer + method->start);
return;
}
if (cmd->deprecated && !deprecated_apis) {
command_fail(jcon->current,
"command '%.*s' is deprecated",
(int)(method->end - method->start),
jcon->buffer + method->start);
return;
}
if (params->type != JSMN_ARRAY && params->type != JSMN_OBJECT) {
command_fail(jcon->current,