mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
lightningd: add --dev-no-version-checks, use if SLOW_MACHINE and VALGRIND
Reduces VALGRIND=1 node_factory.line_graph(5) time on my laptop from 42s to 36s. This is simply because forking all the subdaemons just to check the version is very expensive under valgrind. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
c85a433d9a
commit
1274d34822
@@ -579,6 +579,9 @@ class LightningNode(object):
|
||||
self.daemon.opts["dev-disconnect"] = "dev_disconnect"
|
||||
if DEVELOPER:
|
||||
self.daemon.opts["dev-fail-on-subdaemon-fail"] = None
|
||||
# Don't run --version on every subdaemon if we're valgrinding and slow.
|
||||
if SLOW_MACHINE and VALGRIND:
|
||||
self.daemon.opts["dev-no-version-checks"] = None
|
||||
self.daemon.env["LIGHTNINGD_DEV_MEMLEAK"] = "1"
|
||||
if os.getenv("DEBUG_SUBD"):
|
||||
self.daemon.opts["dev-debugger"] = os.getenv("DEBUG_SUBD")
|
||||
|
||||
@@ -139,6 +139,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
|
||||
ld->dev_force_channel_secrets_shaseed = NULL;
|
||||
ld->dev_force_tmp_channel_id = NULL;
|
||||
ld->dev_no_htlc_timeout = false;
|
||||
ld->dev_no_version_checks = false;
|
||||
#endif
|
||||
|
||||
/*~ These are CCAN lists: an embedded double-linked list. It's not
|
||||
@@ -820,7 +821,12 @@ int main(int argc, char *argv[])
|
||||
* daemon running, so we call before doing almost anything else. */
|
||||
pidfile_create(ld);
|
||||
|
||||
/*~ Make sure we can reach the subdaemons, and versions match. */
|
||||
/*~ Make sure we can reach the subdaemons, and versions match.
|
||||
* This can be turned off in DEVELOPER builds with --dev-skip-version-checks,
|
||||
* but the `dev_no_version_checks` field of `ld` doesn't even exist
|
||||
* if DEVELOPER isn't defined, so we use IFDEV(devoption,non-devoption):
|
||||
*/
|
||||
if (IFDEV(!ld->dev_no_version_checks, 1))
|
||||
test_subdaemons(ld);
|
||||
|
||||
/*~ Set up the HSM daemon, which knows our node secret key, so tells
|
||||
|
||||
@@ -240,6 +240,8 @@ struct lightningd {
|
||||
/* For slow tests (eg protocol tests) don't die if HTLC not
|
||||
* committed in 30 secs */
|
||||
bool dev_no_htlc_timeout;
|
||||
|
||||
bool dev_no_version_checks;
|
||||
#endif /* DEVELOPER */
|
||||
|
||||
/* tor support */
|
||||
|
||||
@@ -553,6 +553,9 @@ static void dev_register_opts(struct lightningd *ld)
|
||||
opt_register_noarg("--dev-fail-process-onionpacket", opt_set_bool,
|
||||
&dev_fail_process_onionpacket,
|
||||
"Force all processing of onion packets to fail");
|
||||
opt_register_noarg("--dev-no-version-checks", opt_set_bool,
|
||||
&ld->dev_no_version_checks,
|
||||
"Skip calling subdaemons with --version on startup");
|
||||
}
|
||||
#endif /* DEVELOPER */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user