mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 08:34:20 +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_disconnect_fd = -1;
|
||||||
ld->dev_hsm_seed = NULL;
|
ld->dev_hsm_seed = NULL;
|
||||||
ld->dev_subdaemon_fail = false;
|
ld->dev_subdaemon_fail = false;
|
||||||
|
ld->no_reconnect = false;
|
||||||
|
|
||||||
if (getenv("LIGHTNINGD_DEV_MEMLEAK"))
|
if (getenv("LIGHTNINGD_DEV_MEMLEAK"))
|
||||||
memleak_init(ld, backtrace_state);
|
memleak_init(ld, backtrace_state);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -66,9 +66,6 @@ struct config {
|
|||||||
/* How often to broadcast gossip (msec) */
|
/* How often to broadcast gossip (msec) */
|
||||||
u32 broadcast_interval;
|
u32 broadcast_interval;
|
||||||
|
|
||||||
/* Disable automatic reconnects */
|
|
||||||
bool no_reconnect;
|
|
||||||
|
|
||||||
/* Channel update interval */
|
/* Channel update interval */
|
||||||
u32 channel_update_interval;
|
u32 channel_update_interval;
|
||||||
|
|
||||||
@@ -152,6 +149,9 @@ struct lightningd {
|
|||||||
|
|
||||||
/* Things we've marked as not leaking. */
|
/* Things we've marked as not leaking. */
|
||||||
const void **notleaks;
|
const void **notleaks;
|
||||||
|
|
||||||
|
/* Disable automatic reconnects */
|
||||||
|
bool no_reconnect;
|
||||||
#endif /* DEVELOPER */
|
#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,
|
opt_register_arg("--fee-per-satoshi", opt_set_s32, opt_show_s32,
|
||||||
&ld->config.fee_per_satoshi,
|
&ld->config.fee_per_satoshi,
|
||||||
"Microsatoshi fee for every satoshi in HTLC");
|
"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,
|
opt_register_arg("--ipaddr", opt_add_ipaddr, NULL,
|
||||||
ld,
|
ld,
|
||||||
"Set the IP address (v4 or v6) to announce to the network for incoming connections");
|
"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)
|
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,
|
opt_register_noarg("--dev-no-broadcast", opt_set_bool,
|
||||||
&ld->topology->dev_no_broadcast, opt_hidden);
|
&ld->topology->dev_no_broadcast, opt_hidden);
|
||||||
opt_register_noarg("--dev-fail-on-subdaemon-fail", opt_set_bool,
|
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 */
|
* Each node SHOULD flush outgoing announcements once every 60 seconds */
|
||||||
.broadcast_interval = 60000,
|
.broadcast_interval = 60000,
|
||||||
|
|
||||||
/* Automatically reconnect */
|
|
||||||
.no_reconnect = false,
|
|
||||||
|
|
||||||
/* Send a keepalive update at least every week, prune every twice that */
|
/* Send a keepalive update at least every week, prune every twice that */
|
||||||
.channel_update_interval = 1209600/2,
|
.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 */
|
* Each node SHOULD flush outgoing announcements once every 60 seconds */
|
||||||
.broadcast_interval = 60000,
|
.broadcast_interval = 60000,
|
||||||
|
|
||||||
/* Automatically reconnect */
|
|
||||||
.no_reconnect = false,
|
|
||||||
|
|
||||||
/* Send a keepalive update at least every week, prune every twice that */
|
/* Send a keepalive update at least every week, prune every twice that */
|
||||||
.channel_update_interval = 1209600/2,
|
.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. */
|
/* Reconnect unless we've dropped/are dropping to chain. */
|
||||||
if (!peer_on_chain(peer) && peer->state != CLOSINGD_COMPLETE) {
|
if (!peer_on_chain(peer) && peer->state != CLOSINGD_COMPLETE) {
|
||||||
|
#if DEVELOPER
|
||||||
/* Don't schedule an attempt if we disabled reconnections with
|
/* Don't schedule an attempt if we disabled reconnections with
|
||||||
* the `--no-reconnect` flag */
|
* the `--dev-no-reconnect` flag */
|
||||||
if (peer->ld->config.no_reconnect)
|
if (peer->ld->no_reconnect)
|
||||||
return;
|
return;
|
||||||
|
#endif /* DEVELOPER */
|
||||||
u8 *msg = towire_gossipctl_reach_peer(peer, &peer->id);
|
u8 *msg = towire_gossipctl_reach_peer(peer, &peer->id);
|
||||||
subd_send_msg(peer->ld->gossip, take(msg));
|
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
|
# HTLC 1->2, 1 fails after it's irrevocably committed, can't reconnect
|
||||||
disconnects = ['@WIRE_REVOKE_AND_ACK']
|
disconnects = ['@WIRE_REVOKE_AND_ACK']
|
||||||
l1 = self.node_factory.get_node(disconnect=disconnects,
|
l1 = self.node_factory.get_node(disconnect=disconnects,
|
||||||
options=['--no-reconnect'])
|
options=['--dev-no-reconnect'])
|
||||||
l2 = self.node_factory.get_node()
|
l2 = self.node_factory.get_node()
|
||||||
|
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
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
|
# HTLC 1->2, 1 fails after 2 has sent committed the fulfill
|
||||||
disconnects = ['-WIRE_REVOKE_AND_ACK*2']
|
disconnects = ['-WIRE_REVOKE_AND_ACK*2']
|
||||||
l1 = self.node_factory.get_node(disconnect=disconnects,
|
l1 = self.node_factory.get_node(disconnect=disconnects,
|
||||||
options=['--no-reconnect'])
|
options=['--dev-no-reconnect'])
|
||||||
l2 = self.node_factory.get_node()
|
l2 = self.node_factory.get_node()
|
||||||
|
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
||||||
@@ -2769,7 +2769,7 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
def test_payment_success_persistence(self):
|
def test_payment_success_persistence(self):
|
||||||
# Start two nodes and open a channel.. die during payment.
|
# Start two nodes and open a channel.. die during payment.
|
||||||
l1 = self.node_factory.get_node(disconnect=['+WIRE_COMMITMENT_SIGNED'],
|
l1 = self.node_factory.get_node(disconnect=['+WIRE_COMMITMENT_SIGNED'],
|
||||||
options=['--no-reconnect'])
|
options=['--dev-no-reconnect'])
|
||||||
l2 = self.node_factory.get_node()
|
l2 = self.node_factory.get_node()
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
||||||
|
|
||||||
@@ -2786,7 +2786,7 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
l1.daemon.kill()
|
l1.daemon.kill()
|
||||||
|
|
||||||
# Restart l1, without disconnect stuff.
|
# 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')
|
l1.daemon.cmd_line.remove('--dev-disconnect=dev_disconnect')
|
||||||
|
|
||||||
# Should reconnect, and sort the payment out.
|
# Should reconnect, and sort the payment out.
|
||||||
@@ -2809,7 +2809,7 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
def test_payment_failed_persistence(self):
|
def test_payment_failed_persistence(self):
|
||||||
# Start two nodes and open a channel.. die during payment.
|
# Start two nodes and open a channel.. die during payment.
|
||||||
l1 = self.node_factory.get_node(disconnect=['+WIRE_COMMITMENT_SIGNED'],
|
l1 = self.node_factory.get_node(disconnect=['+WIRE_COMMITMENT_SIGNED'],
|
||||||
options=['--no-reconnect'])
|
options=['--dev-no-reconnect'])
|
||||||
l2 = self.node_factory.get_node()
|
l2 = self.node_factory.get_node()
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
||||||
|
|
||||||
@@ -2827,7 +2827,7 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
l1.daemon.kill()
|
l1.daemon.kill()
|
||||||
|
|
||||||
# Restart l1, without disconnect stuff.
|
# 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')
|
l1.daemon.cmd_line.remove('--dev-disconnect=dev_disconnect')
|
||||||
|
|
||||||
# Make sure invoice has expired.
|
# Make sure invoice has expired.
|
||||||
|
|||||||
Reference in New Issue
Block a user