plugins: pass back opts as indicated type. fixes #3577

Changelog-Fixed: Plugins: if an option has a type int or bool, return the option as that type to the plugin's init
This commit is contained in:
lisa neigut 2020-03-07 18:10:20 -06:00 committed by Rusty Russell
parent 34cef2cac3
commit 4e30a82f09

View File

@ -1102,6 +1102,14 @@ plugin_populate_init_request(struct plugin *plugin, struct jsonrpc_request *req)
list_for_each(&plugin->plugin_opts, opt, list) {
/* Trim the `--` that we added before */
name = opt->name + 2;
if (opt->value->as_bool) {
json_add_bool(req->stream, name, *opt->value->as_bool);
continue;
}
if (opt->value->as_int) {
json_add_s64(req->stream, name, *opt->value->as_int);
continue;
}
if (opt->value->as_str) {
json_add_string(req->stream, name, opt->value->as_str);
}