mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 13:25:43 +01:00
lightningd: remove --deadline-blocks option.
We will derive it from other factors. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a55ce607a1
commit
c14b159166
@ -55,9 +55,6 @@ struct config {
|
|||||||
/* Maximum time for an expiring HTLC (blocks). */
|
/* Maximum time for an expiring HTLC (blocks). */
|
||||||
u32 max_htlc_expiry;
|
u32 max_htlc_expiry;
|
||||||
|
|
||||||
/* How many blocks before upstream HTLC expiry do we panic and dump? */
|
|
||||||
u32 deadline_blocks;
|
|
||||||
|
|
||||||
/* Fee rates. */
|
/* Fee rates. */
|
||||||
u32 fee_base;
|
u32 fee_base;
|
||||||
s32 fee_per_satoshi;
|
s32 fee_per_satoshi;
|
||||||
|
@ -238,9 +238,6 @@ static void config_register_opts(struct lightningd *ld)
|
|||||||
opt_register_arg("--max-htlc-expiry", opt_set_u32, opt_show_u32,
|
opt_register_arg("--max-htlc-expiry", opt_set_u32, opt_show_u32,
|
||||||
&ld->config.max_htlc_expiry,
|
&ld->config.max_htlc_expiry,
|
||||||
"Maximum number of blocks to accept an HTLC before expiry");
|
"Maximum number of blocks to accept an HTLC before expiry");
|
||||||
opt_register_arg("--deadline-blocks", opt_set_u32, opt_show_u32,
|
|
||||||
&ld->config.deadline_blocks,
|
|
||||||
"Number of blocks before HTLC timeout before we drop connection");
|
|
||||||
opt_register_arg("--bitcoind-poll", opt_set_time, opt_show_time,
|
opt_register_arg("--bitcoind-poll", opt_set_time, opt_show_time,
|
||||||
&ld->config.poll_time,
|
&ld->config.poll_time,
|
||||||
"Time between polling for new transactions");
|
"Time between polling for new transactions");
|
||||||
@ -338,9 +335,6 @@ static const struct config testnet_config = {
|
|||||||
/* Don't lock up channel for more than 5 days. */
|
/* Don't lock up channel for more than 5 days. */
|
||||||
.max_htlc_expiry = 5 * 6 * 24,
|
.max_htlc_expiry = 5 * 6 * 24,
|
||||||
|
|
||||||
/* If we're closing on HTLC expiry, and you're unresponsive, we abort. */
|
|
||||||
.deadline_blocks = 4,
|
|
||||||
|
|
||||||
/* How often to bother bitcoind. */
|
/* How often to bother bitcoind. */
|
||||||
.poll_time = TIME_FROM_SEC(10),
|
.poll_time = TIME_FROM_SEC(10),
|
||||||
|
|
||||||
@ -406,9 +400,6 @@ static const struct config mainnet_config = {
|
|||||||
/* Don't lock up channel for more than 5 days. */
|
/* Don't lock up channel for more than 5 days. */
|
||||||
.max_htlc_expiry = 5 * 6 * 24,
|
.max_htlc_expiry = 5 * 6 * 24,
|
||||||
|
|
||||||
/* If we're closing on HTLC expiry, and you're unresponsive, we abort. */
|
|
||||||
.deadline_blocks = 10,
|
|
||||||
|
|
||||||
/* How often to bother bitcoind. */
|
/* How often to bother bitcoind. */
|
||||||
.poll_time = TIME_FROM_SEC(30),
|
.poll_time = TIME_FROM_SEC(30),
|
||||||
|
|
||||||
@ -441,17 +432,6 @@ static void check_config(struct lightningd *ld)
|
|||||||
|
|
||||||
if (ld->config.anchor_confirms == 0)
|
if (ld->config.anchor_confirms == 0)
|
||||||
fatal("anchor-confirms must be greater than zero");
|
fatal("anchor-confirms must be greater than zero");
|
||||||
|
|
||||||
/* FIXME-OLD #2:
|
|
||||||
*
|
|
||||||
* a node MUST estimate the deadline for successful redemption
|
|
||||||
* for each HTLC it offers. A node MUST NOT offer a HTLC
|
|
||||||
* after this deadline */
|
|
||||||
if (ld->config.deadline_blocks >= ld->config.cltv_final
|
|
||||||
|| ld->config.deadline_blocks >= ld->config.cltv_expiry_delta)
|
|
||||||
fatal("Deadline %u can't be more than final/expiry %u/%u",
|
|
||||||
ld->config.deadline_blocks,
|
|
||||||
ld->config.cltv_final, ld->config.cltv_expiry_delta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_default_config(struct lightningd *ld)
|
static void setup_default_config(struct lightningd *ld)
|
||||||
|
@ -527,22 +527,19 @@ static void forward_htlc(struct htlc_in *hin,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BOLT #4:
|
/* BOLT #2:
|
||||||
*
|
*
|
||||||
* If the `cltv_expiry` is too near, we tell them the the current channel
|
* A node MUST estimate a timeout deadline for each HTLC it offers. A
|
||||||
* setting for the outgoing channel:
|
* node MUST NOT offer an HTLC with a timeout deadline before its
|
||||||
* 1. type: UPDATE|14 (`expiry_too_soon`)
|
* `cltv_expiry`
|
||||||
* 2. data:
|
|
||||||
* * [`2`:`len`]
|
|
||||||
* * [`len`:`channel_update`]
|
|
||||||
*/
|
*/
|
||||||
if (get_block_height(next->ld->topology)
|
/* In our case, G = 1, so we need to expire it one after it's expiration.
|
||||||
+ next->ld->config.deadline_blocks >= outgoing_cltv_value) {
|
* But never offer an expired HTLC; that's dumb. */
|
||||||
|
if (get_block_height(next->ld->topology) >= outgoing_cltv_value) {
|
||||||
log_debug(hin->key.peer->log,
|
log_debug(hin->key.peer->log,
|
||||||
"Expiry cltv %u too close to current %u + deadline %u",
|
"Expiry cltv %u too close to current %u",
|
||||||
outgoing_cltv_value,
|
outgoing_cltv_value,
|
||||||
get_block_height(next->ld->topology),
|
get_block_height(next->ld->topology));
|
||||||
next->ld->config.deadline_blocks);
|
|
||||||
failcode = WIRE_EXPIRY_TOO_SOON;
|
failcode = WIRE_EXPIRY_TOO_SOON;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ BITCOIND_CONFIG = {
|
|||||||
LIGHTNINGD_CONFIG = {
|
LIGHTNINGD_CONFIG = {
|
||||||
"bitcoind-poll": "1s",
|
"bitcoind-poll": "1s",
|
||||||
"log-level": "debug",
|
"log-level": "debug",
|
||||||
"deadline-blocks": 4,
|
|
||||||
"cltv-delta": 6,
|
"cltv-delta": 6,
|
||||||
"cltv-final": 5,
|
"cltv-final": 5,
|
||||||
"locktime-blocks": 5,
|
"locktime-blocks": 5,
|
||||||
|
Loading…
Reference in New Issue
Block a user