mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 08:04:23 +01:00
Added possibility to configure max_concurrent_htlcs value for our channels. Eclaire has a default of 30 and I thought why not going with their value and while doing so make it configureable.
This commit is contained in:
committed by
Rusty Russell
parent
0bd95fc068
commit
8e7428da53
@@ -42,6 +42,9 @@ struct config {
|
||||
u32 fee_base;
|
||||
u32 fee_per_satoshi;
|
||||
|
||||
/* htlcs per channel */
|
||||
u32 max_concurrent_htlcs;
|
||||
|
||||
/* How long between changing commit and sending COMMIT message. */
|
||||
u32 commit_time_ms;
|
||||
|
||||
|
||||
@@ -835,13 +835,7 @@ static void channel_config(struct lightningd *ld,
|
||||
*/
|
||||
ours->to_self_delay = ld->config.locktime_blocks;
|
||||
|
||||
/* BOLT #2:
|
||||
*
|
||||
* The receiving node MUST fail the channel if:
|
||||
*...
|
||||
* - `max_accepted_htlcs` is greater than 483.
|
||||
*/
|
||||
ours->max_accepted_htlcs = 483;
|
||||
ours->max_accepted_htlcs = ld->config.max_concurrent_htlcs;
|
||||
|
||||
/* This is filled in by lightning_openingd, for consistency. */
|
||||
ours->channel_reserve = AMOUNT_SAT(UINT64_MAX);
|
||||
|
||||
@@ -457,6 +457,9 @@ static const struct config testnet_config = {
|
||||
/* We offer to pay 5 times 2-block fee */
|
||||
.commitment_fee_percent = 500,
|
||||
|
||||
/* Testnet blockspace is free. */
|
||||
.max_concurrent_htlcs = 483,
|
||||
|
||||
/* Be aggressive on testnet. */
|
||||
.cltv_expiry_delta = 6,
|
||||
.cltv_final = 10,
|
||||
@@ -513,6 +516,9 @@ static const struct config mainnet_config = {
|
||||
/* We offer to pay 5 times 2-block fee */
|
||||
.commitment_fee_percent = 500,
|
||||
|
||||
/* While up to 483 htlcs are possible we do 30 by default (as eclair does) to save blockspace */
|
||||
.max_concurrent_htlcs = 30,
|
||||
|
||||
/* BOLT #2:
|
||||
*
|
||||
* 1. the `cltv_expiry_delta` for channels, `3R+2G+2S`: if in doubt, a
|
||||
@@ -569,7 +575,15 @@ static void check_config(struct lightningd *ld)
|
||||
fatal("Commitment fee invalid min-max %u-%u",
|
||||
ld->config.commitment_fee_min_percent,
|
||||
ld->config.commitment_fee_max_percent);
|
||||
|
||||
/* BOLT #2:
|
||||
*
|
||||
* The receiving node MUST fail the channel if:
|
||||
*...
|
||||
* - `max_accepted_htlcs` is greater than 483.
|
||||
*/
|
||||
if (ld->config.max_concurrent_htlcs < 1 || ld->config.max_concurrent_htlcs > 483)
|
||||
fatal("--max-concurrent-htlcs value must be between 1 and 483 it is: %u",
|
||||
ld->config.max_concurrent_htlcs);
|
||||
if (ld->config.anchor_confirms == 0)
|
||||
fatal("anchor-confirms must be greater than zero");
|
||||
|
||||
@@ -928,6 +942,9 @@ static void register_opts(struct lightningd *ld)
|
||||
opt_register_arg("--fee-per-satoshi", opt_set_u32, opt_show_u32,
|
||||
&ld->config.fee_per_satoshi,
|
||||
"Microsatoshi fee for every satoshi in HTLC");
|
||||
opt_register_arg("--max-concurrent-htlcs", opt_set_u32, opt_show_u32,
|
||||
&ld->config.max_concurrent_htlcs,
|
||||
"Number of HTLCs one channel can handle concurrently. Should be between 1 and 483");
|
||||
opt_register_arg("--min-capacity-sat", opt_set_u64, opt_show_u64,
|
||||
&ld->config.min_capacity_sat,
|
||||
"Minimum capacity in satoshis for accepting channels");
|
||||
|
||||
Reference in New Issue
Block a user