lightningd/plugin: extend plugins->startup window to include plugins_config

Fixes incorrect configuration[`startup`] in plugin `init`, modified tests
to test this.
This commit is contained in:
Simon Vrouwe 2019-08-24 11:51:58 +03:00 committed by Rusty Russell
parent c2f58aec9d
commit 5b5d70d640
4 changed files with 6 additions and 6 deletions

View File

@ -1019,8 +1019,6 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug)
if (plugins->pending_manifests > 0)
io_loop_with_timers(plugins->ld);
// There won't be io_loop anymore to wait for plugins
plugins->startup = false;
}
static void plugin_config_cb(const char *buffer,
@ -1074,6 +1072,8 @@ void plugins_config(struct plugins *plugins)
plugin_config(p);
}
}
plugins->startup = false;
}
void json_add_opt_plugins(struct json_stream *response,

View File

@ -20,7 +20,7 @@ def init(configuration, options, plugin):
plugin.conn.execute(c)
plugin.log("{}".format(c))
plugin.initted = True
plugin.log("initialized")
plugin.log("initialized {}".format(configuration))
@plugin.hook('db_write')

View File

@ -7,7 +7,7 @@ plugin = Plugin()
@plugin.init()
def init(options, configuration, plugin):
plugin.log("slow_init.py initializing")
plugin.log("slow_init.py initializing {}".format(configuration))
time.sleep(1)

View File

@ -98,7 +98,7 @@ def test_plugin_slowinit(node_factory):
n = node_factory.get_node()
n.rpc.plugin_start(os.path.join(os.getcwd(), "tests/plugins/slow_init.py"))
n.daemon.wait_for_log("slow_init.py initializing")
n.daemon.wait_for_log("slow_init.py initializing.* 'startup': False")
# It's not actually configured yet, see what happens;
# make sure 'rescan' and 'list' controls dont crash
@ -304,7 +304,7 @@ def test_db_hook(node_factory, executor):
l1.daemon.wait_for_log('plugin-dblog.py replaying pre-init data:')
l1.daemon.wait_for_log('plugin-dblog.py PRAGMA foreign_keys = ON;')
l1.daemon.wait_for_log('plugin-dblog.py CREATE TABLE version \\(version INTEGER\\)')
l1.daemon.wait_for_log('plugin-dblog.py initialized')
l1.daemon.wait_for_log("plugin-dblog.py initialized.* 'startup': True")
l1.stop()