Browse Source

options: Add --dev-max-funding-unconfirmed-blocks.

Maximum number of blocks where funding tx is unconfirmed,
after which if we are the fundee, we forget the channel.
ppa-0.6.1
ZmnSCPxj 7 years ago
committed by Christian Decker
parent
commit
e95143af9a
  1. 9
      lightningd/channel_control.c
  2. 2
      lightningd/lightningd.c
  3. 4
      lightningd/lightningd.h
  4. 9
      lightningd/options.c

9
lightningd/channel_control.c

@ -341,12 +341,7 @@ is_fundee_should_forget(struct lightningd *ld,
struct channel *channel,
u32 block_height)
{
u32 max_no_funding_tx = 2016;
/* FIXME: we should be getting max_no_funding_tx
* from an lightningd option, which is why we get
* it as an argument. */
(void) ld;
u32 max_funding_unconfirmed = ld->max_funding_unconfirmed;
/* BOLT #2:
*
@ -369,7 +364,7 @@ is_fundee_should_forget(struct lightningd *ld,
return false;
/* Timeout in blocks not yet reached. */
if (block_height - channel->first_blocknum < max_no_funding_tx)
if (block_height - channel->first_blocknum < max_funding_unconfirmed)
return false;
/* Ah forget it! */

2
lightningd/lightningd.c

@ -87,6 +87,8 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
ld->use_proxy_always = false;
ld->pure_tor_setup = false;
ld->tor_service_password = NULL;
ld->max_funding_unconfirmed = 2016;
return ld;
}

4
lightningd/lightningd.h

@ -160,6 +160,10 @@ struct lightningd {
u64 ini_autocleaninvoice_cycle;
u64 ini_autocleaninvoice_expiredby;
/* Number of blocks we wait for a channel to get funded
* if we are the fundee. */
u32 max_funding_unconfirmed;
#if DEVELOPER
/* If we want to debug a subdaemon. */
const char *dev_debug_subdaemon;

9
lightningd/options.c

@ -406,6 +406,15 @@ static void config_register_opts(struct lightningd *ld)
opt_register_early_arg("--always-use-proxy",
opt_set_bool_arg, opt_show_bool,
&ld->use_proxy_always, "Use the proxy always");
#if DEVELOPER
opt_register_arg("--dev-max-funding-unconfirmed-blocks",
opt_set_u32, opt_show_u32,
&ld->max_funding_unconfirmed,
"Maximum number of blocks we wait for a channel "
"funding transaction to confirm, if we are the "
"fundee.");
#endif
}
#if DEVELOPER

Loading…
Cancel
Save