mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 13:25:43 +01:00
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).
This commit is contained in:
parent
329c19f5ab
commit
646c564ec5
@ -1525,15 +1525,9 @@ plugin_populate_init_request(struct plugin *plugin, struct jsonrpc_request *req)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
json_add_bool(req->stream, name, *opt->value->as_bool);
|
json_add_bool(req->stream, name, *opt->value->as_bool);
|
||||||
if (!deprecated_apis)
|
} else if (opt->value->as_int) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (opt->value->as_int) {
|
|
||||||
json_add_s64(req->stream, name, *opt->value->as_int);
|
json_add_s64(req->stream, name, *opt->value->as_int);
|
||||||
if (!deprecated_apis)
|
} else if (opt->value->as_str) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (opt->value->as_str) {
|
|
||||||
json_add_string(req->stream, name, opt->value->as_str);
|
json_add_string(req->stream, name, opt->value->as_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,6 @@ def test_option_passthrough(node_factory, directory):
|
|||||||
n.stop()
|
n.stop()
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(DEPRECATED_APIS, "We test the new API.")
|
|
||||||
def test_option_types(node_factory):
|
def test_option_types(node_factory):
|
||||||
"""Ensure that desired types of options are
|
"""Ensure that desired types of options are
|
||||||
respected in output """
|
respected in output """
|
||||||
@ -121,25 +120,6 @@ def test_option_types(node_factory):
|
|||||||
assert not n.daemon.running
|
assert not n.daemon.running
|
||||||
assert n.daemon.is_in_stderr("--flag_opt: doesn't allow an argument")
|
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):
|
def test_millisatoshi_passthrough(node_factory):
|
||||||
""" Ensure that Millisatoshi arguments and return work.
|
""" Ensure that Millisatoshi arguments and return work.
|
||||||
|
Loading…
Reference in New Issue
Block a user