Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecations for v0.9.2 #4049

Merged
merged 6 commits into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions lightningd/jsonrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,28 +712,6 @@ rpc_command_hook_callback(struct rpc_command_hook_payload *p STEALS,
return was_pending(command_exec(p->cmd->jcon, p->cmd, p->buffer,
p->request, params));

#ifdef COMPAT_V080
if (deprecated_apis) {
const jsmntok_t *tok_continue;
bool exec;
tok_continue = json_get_member(buffer, resulttok, "continue");
if (tok_continue && json_to_bool(buffer, tok_continue, &exec) && exec) {
static bool warned = false;
if (!warned) {
warned = true;
log_unusual(p->cmd->ld->log,
"Plugin returned 'continue' : true "
"to rpc_command hook. "
"This is now deprecated and "
"you should return with "
"{'result': 'continue'} instead.");
}
return was_pending(command_exec(p->cmd->jcon, p->cmd, p->buffer,
p->request, params));
}
}
#endif /* defined(COMPAT_V080) */

innerresulttok = json_get_member(buffer, resulttok, "result");
if (innerresulttok) {
if (json_tok_streq(buffer, innerresulttok, "continue")) {
Expand Down
11 changes: 0 additions & 11 deletions lightningd/peer_htlcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,17 +987,6 @@ static void htlc_accepted_hook_serialize(struct htlc_accepted_hook_payload *p,
if (p->payload) {
switch (p->payload->type) {
case ONION_V0_PAYLOAD:
if (deprecated_apis) {
json_object_start(s, "per_hop_v0");
json_add_string(s, "realm", "00");
json_add_short_channel_id(s, "short_channel_id",
p->payload->forward_channel);
json_add_amount_msat_only(s, "forward_amount",
p->payload->amt_to_forward);
json_add_u64(s, "outgoing_cltv_value",
p->payload->outgoing_cltv);
json_object_end(s);
}
json_add_string(s, "type", "legacy");
break;

Expand Down
32 changes: 4 additions & 28 deletions lightningd/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,24 +1223,10 @@ char *add_plugin_dir(struct plugins *plugins, const char *dir, bool error_ok)
struct plugin *p;

if (!d) {
if (deprecated_apis && !path_is_abs(dir)) {
dir = path_join(tmpctx,
plugins->ld->original_directory, dir);
d = opendir(dir);
if (d) {
log_unusual(plugins->log, "DEPRECATED WARNING:"
" plugin-dir is now relative to"
" lightning-dir, please change to"
" plugin-dir=%s",
dir);
}
}
if (!d) {
if (!error_ok && errno == ENOENT)
return NULL;
return tal_fmt(NULL, "Failed to open plugin-dir %s: %s",
dir, strerror(errno));
}
if (!error_ok && errno == ENOENT)
return NULL;
return tal_fmt(NULL, "Failed to open plugin-dir %s: %s",
dir, strerror(errno));
}

while ((di = readdir(d)) != NULL) {
Expand Down Expand Up @@ -1559,18 +1545,8 @@ void json_add_opt_plugins_array(struct json_stream *response,
void json_add_opt_plugins(struct json_stream *response,
const struct plugins *plugins)
{
struct plugin *p;

json_add_opt_plugins_array(response, "plugins", plugins, false);
json_add_opt_plugins_array(response, "important-plugins", plugins, true);

/* DEPRECATED: duplicated JSON "plugin" entries */
if (deprecated_apis) {
list_for_each(&plugins->plugins, p, list) {
json_add_string(response, p->important ? "important-plugin" : "plugin", p->cmd);
}
}

}

void json_add_opt_disable_plugins(struct json_stream *response,
Expand Down
4 changes: 0 additions & 4 deletions lightningd/plugin_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ plugin_dynamic_stop(struct command *cmd, const char *plugin_name)
plugin_name);
plugin_kill(p, "stopped by lightningd via RPC");
response = json_stream_success(cmd);
if (deprecated_apis)
json_add_string(response, "",
take(tal_fmt(NULL, "Successfully stopped %s.",
plugin_name)));
json_add_string(response, "result",
take(tal_fmt(NULL, "Successfully stopped %s.",
plugin_name)));
Expand Down
27 changes: 0 additions & 27 deletions lightningd/plugin_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,33 +299,6 @@ static void db_hook_response(const char *buffer, const jsmntok_t *toks,
fatal("Plugin returned an invalid response to the db_write "
"hook: %s", buffer);

#ifdef COMPAT_V080
/* For back-compatibility we allow to return a simple Boolean true. */
if (deprecated_apis) {
bool resp;
if (json_to_bool(buffer, resulttok, &resp)) {
static bool warned = false;
/* If it fails, we must not commit to our db. */
if (!resp)
fatal("Plugin returned failed db_write: %s.",
buffer);
if (!warned) {
warned = true;
log_unusual(ph_req->db->log,
"Plugin returned 'true' to "
"'db_hook'. "
"This is now deprecated and "
"you should return "
"{'result': 'continue'} "
"instead.");
}
/* Resume. */
io_break(ph_req);
return;
}
}
#endif /* defined(COMPAT_V080) */

/* We expect result: { 'result' : 'continue' }.
* Anything else we abort.
*/
Expand Down