Browse Source

plugins: remove deprecated string plugin options.

This was fixed in 0.8.2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: plugins: options to init are no longer given as strings if they are bool or int types (deprecated in 0.8.2).
ppa
Rusty Russell 4 years ago
parent
commit
646c564ec5
  1. 10
      lightningd/plugin.c
  2. 20
      tests/test_plugin.py

10
lightningd/plugin.c

@ -1525,15 +1525,9 @@ plugin_populate_init_request(struct plugin *plugin, struct jsonrpc_request *req)
continue;
json_add_bool(req->stream, name, *opt->value->as_bool);
if (!deprecated_apis)
continue;
}
if (opt->value->as_int) {
} else if (opt->value->as_int) {
json_add_s64(req->stream, name, *opt->value->as_int);
if (!deprecated_apis)
continue;
}
if (opt->value->as_str) {
} else if (opt->value->as_str) {
json_add_string(req->stream, name, opt->value->as_str);
}
}

20
tests/test_plugin.py

@ -52,7 +52,6 @@ def test_option_passthrough(node_factory, directory):
n.stop()
@unittest.skipIf(DEPRECATED_APIS, "We test the new API.")
def test_option_types(node_factory):
"""Ensure that desired types of options are
respected in output """
@ -121,25 +120,6 @@ def test_option_types(node_factory):
assert not n.daemon.running
assert n.daemon.is_in_stderr("--flag_opt: doesn't allow an argument")
plugin_path = os.path.join(os.getcwd(), 'tests/plugins/options.py')
n = node_factory.get_node(options={
'plugin': plugin_path,
'str_opt': 'ok',
'int_opt': 22,
'bool_opt': 1,
'flag_opt': None,
'allow-deprecated-apis': True
})
# because of how the python json parser works, since we're adding the deprecated
# string option after the 'typed' option in the JSON, the string option overwrites
# the earlier typed option in JSON parsing, resulting in a option set of only strings
assert n.daemon.is_in_log(r"option str_opt ok <class 'str'>")
assert n.daemon.is_in_log(r"option int_opt 22 <class 'str'>")
assert n.daemon.is_in_log(r"option bool_opt 1 <class 'str'>")
assert n.daemon.is_in_log(r"option flag_opt True <class 'bool'>")
n.stop()
def test_millisatoshi_passthrough(node_factory):
""" Ensure that Millisatoshi arguments and return work.

Loading…
Cancel
Save