From 48796f4f394e2c8190e5ad792fdae1c4dc8ff1fb Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 6 Oct 2017 00:02:19 +0200 Subject: [PATCH] cli: Add --no-reconnect cli flag Especially when testing we might want to disable the automatic reconnection logic in order not to masquerade bugs that disappear when reconnecting. Signed-off-by: Christian Decker --- lightningd/lightningd.h | 3 +++ lightningd/options.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/lightningd/lightningd.h b/lightningd/lightningd.h index 93464d953..3b4efd6b8 100644 --- a/lightningd/lightningd.h +++ b/lightningd/lightningd.h @@ -64,6 +64,9 @@ struct config { /* IPv4 or IPv6 address to announce to the network */ struct ipaddr ipaddr; + + /* Disable automatic reconnects */ + bool no_reconnect; }; struct lightningd { diff --git a/lightningd/options.c b/lightningd/options.c index fb171108c..1af79417f 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -224,6 +224,8 @@ static void config_register_opts(struct lightningd *ld) opt_register_arg("--fee-per-satoshi", opt_set_s32, opt_show_s32, &ld->config.fee_per_satoshi, "Microsatoshi fee for every satoshi in HTLC"); + opt_register_noarg("--no-reconnect", opt_set_bool, + &ld->config.no_reconnect, "Disable automatic reconnect attempts"); opt_register_arg("--ipaddr", opt_set_ipaddr, NULL, &ld->config.ipaddr, @@ -298,6 +300,9 @@ static const struct config testnet_config = { /* Do not advertise any IP */ .ipaddr.type = 0, + + /* Automatically reconnect */ + .no_reconnect = false, }; /* aka. "Dude, where's my coins?" */ @@ -356,6 +361,9 @@ static const struct config mainnet_config = { /* Do not advertise any IP */ .ipaddr.type = 0, + + /* Automatically reconnect */ + .no_reconnect = false, }; static void check_config(struct lightningd *ld)