From 3ca7150c03018fe67ae94b33b1ffd650a089bbdb Mon Sep 17 00:00:00 2001 From: darosior Date: Sat, 5 Oct 2019 20:12:09 +0200 Subject: [PATCH] lightningd: initialize global chainparams in main. Otherwise the global is only set when passing the '--network' startup option, hence causing a segfault when not passed. --- lightningd/lightningd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index a78cfc69c..bb45b955f 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -665,6 +665,10 @@ int main(int argc, char *argv[]) * variables. */ ld = new_lightningd(NULL); + /*~ The global chainparams is needed to init subdaemons, and defaults + * to testnet. */ + chainparams = chainparams_for_network("testnet"); + /* Figure out where our daemons are first. */ ld->daemon_dir = find_daemon_dir(ld, argv[0]); if (!ld->daemon_dir)