mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +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:
parent
097a8e72d1
commit
e95143af9a
@ -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! */
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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…
Reference in New Issue
Block a user