diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 35c736e0d..04948a0ce 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -1128,11 +1128,13 @@ plugin_populate_init_request(struct plugin *plugin, struct jsonrpc_request *req) name = opt->name + 2; if (opt->value->as_bool) { json_add_bool(req->stream, name, *opt->value->as_bool); - continue; + if (!deprecated_apis) + continue; } if (opt->value->as_int) { json_add_s64(req->stream, name, *opt->value->as_int); - continue; + if (!deprecated_apis) + continue; } if (opt->value->as_str) { json_add_string(req->stream, name, opt->value->as_str); diff --git a/tests/test_plugin.py b/tests/test_plugin.py index f3eebbbfd..440b0dd45 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -55,7 +55,7 @@ def test_option_types(node_factory): 'plugin': plugin_path, 'str_opt': 'ok', 'int_opt': 22, - 'bool_opt': 1, + 'bool_opt': True, }) n.daemon.is_in_log(r"option str_opt ok ") @@ -82,6 +82,7 @@ def test_option_types(node_factory): }, expect_fail=True, may_fail=True) # the node should fail to start, and we get a stderr msg + assert not n.daemon.running assert n.daemon.is_in_stderr('bool_opt: ! does not parse as type bool') # What happens if we give it a bad int-option? @@ -93,8 +94,24 @@ def test_option_types(node_factory): }, may_fail=True, expect_fail=True) # the node should fail to start, and we get a stderr msg + assert not n.daemon.running assert n.daemon.is_in_stderr('--int_opt: notok does not parse as type int') + 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, + }) + + n.daemon.is_in_log(r"option str_opt ok ") + n.daemon.is_in_log(r"option int_opt 22 ") + n.daemon.is_in_log(r"option int_opt 22 ") + n.daemon.is_in_log(r"option bool_opt True ") + n.daemon.is_in_log(r"option bool_opt true ") + n.stop() + def test_millisatoshi_passthrough(node_factory): """ Ensure that Millisatoshi arguments and return work.