mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 00:24:19 +01:00
lightningd: rename --no-reconnect to --dev-no-reconnect.
It's a dev option. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
bd3480dc9c
commit
0600aac68f
@@ -47,6 +47,8 @@ static struct lightningd *new_lightningd(const tal_t *ctx,
|
||||
ld->dev_disconnect_fd = -1;
|
||||
ld->dev_hsm_seed = NULL;
|
||||
ld->dev_subdaemon_fail = false;
|
||||
ld->no_reconnect = false;
|
||||
|
||||
if (getenv("LIGHTNINGD_DEV_MEMLEAK"))
|
||||
memleak_init(ld, backtrace_state);
|
||||
#endif
|
||||
|
||||
@@ -66,9 +66,6 @@ struct config {
|
||||
/* How often to broadcast gossip (msec) */
|
||||
u32 broadcast_interval;
|
||||
|
||||
/* Disable automatic reconnects */
|
||||
bool no_reconnect;
|
||||
|
||||
/* Channel update interval */
|
||||
u32 channel_update_interval;
|
||||
|
||||
@@ -152,6 +149,9 @@ struct lightningd {
|
||||
|
||||
/* Things we've marked as not leaking. */
|
||||
const void **notleaks;
|
||||
|
||||
/* Disable automatic reconnects */
|
||||
bool no_reconnect;
|
||||
#endif /* DEVELOPER */
|
||||
};
|
||||
|
||||
|
||||
@@ -262,9 +262,6 @@ 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_add_ipaddr, NULL,
|
||||
ld,
|
||||
"Set the IP address (v4 or v6) to announce to the network for incoming connections");
|
||||
@@ -291,6 +288,9 @@ static char *opt_set_hsm_seed(const char *arg, struct lightningd *ld)
|
||||
|
||||
static void dev_register_opts(struct lightningd *ld)
|
||||
{
|
||||
opt_register_noarg("--dev-no-reconnect", opt_set_bool,
|
||||
&ld->no_reconnect,
|
||||
"Disable automatic reconnect attempts");
|
||||
opt_register_noarg("--dev-no-broadcast", opt_set_bool,
|
||||
&ld->topology->dev_no_broadcast, opt_hidden);
|
||||
opt_register_noarg("--dev-fail-on-subdaemon-fail", opt_set_bool,
|
||||
@@ -352,9 +352,6 @@ static const struct config testnet_config = {
|
||||
* Each node SHOULD flush outgoing announcements once every 60 seconds */
|
||||
.broadcast_interval = 60000,
|
||||
|
||||
/* Automatically reconnect */
|
||||
.no_reconnect = false,
|
||||
|
||||
/* Send a keepalive update at least every week, prune every twice that */
|
||||
.channel_update_interval = 1209600/2,
|
||||
|
||||
@@ -416,9 +413,6 @@ static const struct config mainnet_config = {
|
||||
* Each node SHOULD flush outgoing announcements once every 60 seconds */
|
||||
.broadcast_interval = 60000,
|
||||
|
||||
/* Automatically reconnect */
|
||||
.no_reconnect = false,
|
||||
|
||||
/* Send a keepalive update at least every week, prune every twice that */
|
||||
.channel_update_interval = 1209600/2,
|
||||
|
||||
|
||||
@@ -267,11 +267,12 @@ void peer_fail_transient(struct peer *peer, const char *fmt, ...)
|
||||
|
||||
/* Reconnect unless we've dropped/are dropping to chain. */
|
||||
if (!peer_on_chain(peer) && peer->state != CLOSINGD_COMPLETE) {
|
||||
#if DEVELOPER
|
||||
/* Don't schedule an attempt if we disabled reconnections with
|
||||
* the `--no-reconnect` flag */
|
||||
if (peer->ld->config.no_reconnect)
|
||||
* the `--dev-no-reconnect` flag */
|
||||
if (peer->ld->no_reconnect)
|
||||
return;
|
||||
|
||||
#endif /* DEVELOPER */
|
||||
u8 *msg = towire_gossipctl_reach_peer(peer, &peer->id);
|
||||
subd_send_msg(peer->ld->gossip, take(msg));
|
||||
}
|
||||
|
||||
@@ -2042,7 +2042,7 @@ class LightningDTests(BaseLightningDTests):
|
||||
# HTLC 1->2, 1 fails after it's irrevocably committed, can't reconnect
|
||||
disconnects = ['@WIRE_REVOKE_AND_ACK']
|
||||
l1 = self.node_factory.get_node(disconnect=disconnects,
|
||||
options=['--no-reconnect'])
|
||||
options=['--dev-no-reconnect'])
|
||||
l2 = self.node_factory.get_node()
|
||||
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
||||
@@ -2098,7 +2098,7 @@ class LightningDTests(BaseLightningDTests):
|
||||
# HTLC 1->2, 1 fails after 2 has sent committed the fulfill
|
||||
disconnects = ['-WIRE_REVOKE_AND_ACK*2']
|
||||
l1 = self.node_factory.get_node(disconnect=disconnects,
|
||||
options=['--no-reconnect'])
|
||||
options=['--dev-no-reconnect'])
|
||||
l2 = self.node_factory.get_node()
|
||||
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
||||
@@ -2769,7 +2769,7 @@ class LightningDTests(BaseLightningDTests):
|
||||
def test_payment_success_persistence(self):
|
||||
# Start two nodes and open a channel.. die during payment.
|
||||
l1 = self.node_factory.get_node(disconnect=['+WIRE_COMMITMENT_SIGNED'],
|
||||
options=['--no-reconnect'])
|
||||
options=['--dev-no-reconnect'])
|
||||
l2 = self.node_factory.get_node()
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
||||
|
||||
@@ -2786,7 +2786,7 @@ class LightningDTests(BaseLightningDTests):
|
||||
l1.daemon.kill()
|
||||
|
||||
# Restart l1, without disconnect stuff.
|
||||
l1.daemon.cmd_line.remove('--no-reconnect')
|
||||
l1.daemon.cmd_line.remove('--dev-no-reconnect')
|
||||
l1.daemon.cmd_line.remove('--dev-disconnect=dev_disconnect')
|
||||
|
||||
# Should reconnect, and sort the payment out.
|
||||
@@ -2809,7 +2809,7 @@ class LightningDTests(BaseLightningDTests):
|
||||
def test_payment_failed_persistence(self):
|
||||
# Start two nodes and open a channel.. die during payment.
|
||||
l1 = self.node_factory.get_node(disconnect=['+WIRE_COMMITMENT_SIGNED'],
|
||||
options=['--no-reconnect'])
|
||||
options=['--dev-no-reconnect'])
|
||||
l2 = self.node_factory.get_node()
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
||||
|
||||
@@ -2827,7 +2827,7 @@ class LightningDTests(BaseLightningDTests):
|
||||
l1.daemon.kill()
|
||||
|
||||
# Restart l1, without disconnect stuff.
|
||||
l1.daemon.cmd_line.remove('--no-reconnect')
|
||||
l1.daemon.cmd_line.remove('--dev-no-reconnect')
|
||||
l1.daemon.cmd_line.remove('--dev-disconnect=dev_disconnect')
|
||||
|
||||
# Make sure invoice has expired.
|
||||
|
||||
Reference in New Issue
Block a user