mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
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.
This commit is contained in:
committed by
Christian Decker
parent
097a8e72d1
commit
e95143af9a
@@ -341,12 +341,7 @@ is_fundee_should_forget(struct lightningd *ld,
|
|||||||
struct channel *channel,
|
struct channel *channel,
|
||||||
u32 block_height)
|
u32 block_height)
|
||||||
{
|
{
|
||||||
u32 max_no_funding_tx = 2016;
|
u32 max_funding_unconfirmed = ld->max_funding_unconfirmed;
|
||||||
|
|
||||||
/* FIXME: we should be getting max_no_funding_tx
|
|
||||||
* from an lightningd option, which is why we get
|
|
||||||
* it as an argument. */
|
|
||||||
(void) ld;
|
|
||||||
|
|
||||||
/* BOLT #2:
|
/* BOLT #2:
|
||||||
*
|
*
|
||||||
@@ -369,7 +364,7 @@ is_fundee_should_forget(struct lightningd *ld,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Timeout in blocks not yet reached. */
|
/* 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;
|
return false;
|
||||||
|
|
||||||
/* Ah forget it! */
|
/* Ah forget it! */
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
|
|||||||
ld->use_proxy_always = false;
|
ld->use_proxy_always = false;
|
||||||
ld->pure_tor_setup = false;
|
ld->pure_tor_setup = false;
|
||||||
ld->tor_service_password = NULL;
|
ld->tor_service_password = NULL;
|
||||||
|
ld->max_funding_unconfirmed = 2016;
|
||||||
|
|
||||||
return ld;
|
return ld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -160,6 +160,10 @@ struct lightningd {
|
|||||||
u64 ini_autocleaninvoice_cycle;
|
u64 ini_autocleaninvoice_cycle;
|
||||||
u64 ini_autocleaninvoice_expiredby;
|
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 DEVELOPER
|
||||||
/* If we want to debug a subdaemon. */
|
/* If we want to debug a subdaemon. */
|
||||||
const char *dev_debug_subdaemon;
|
const char *dev_debug_subdaemon;
|
||||||
|
|||||||
@@ -406,6 +406,15 @@ static void config_register_opts(struct lightningd *ld)
|
|||||||
opt_register_early_arg("--always-use-proxy",
|
opt_register_early_arg("--always-use-proxy",
|
||||||
opt_set_bool_arg, opt_show_bool,
|
opt_set_bool_arg, opt_show_bool,
|
||||||
&ld->use_proxy_always, "Use the proxy always");
|
&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
|
#if DEVELOPER
|
||||||
|
|||||||
Reference in New Issue
Block a user