mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
config: adds htlc_minimum_msat htlc_maximum_msat announce_discovered_ip
This adds config and commandline options for htlc_min_msat, htlc_max_msat and announce_discovered_ip. The default is 0msat for htlc_min_msat, unlimited for htlc_max_msat and enabled for announce_discovered_ip. The announce_discovered_ip gets the disable commandline switch --disable-ip-discovery Changelog-added: Config options for htlc_min_msat, htlc_max_msat and announce_discovered_ip.
This commit is contained in:
parent
c1e7c14c46
commit
21fd3b22d4
@ -33,6 +33,10 @@ struct config {
|
||||
/* htlcs per channel */
|
||||
u32 max_concurrent_htlcs;
|
||||
|
||||
/* htlc min/max values */
|
||||
struct amount_msat htlc_minimum_msat;
|
||||
struct amount_msat htlc_maximum_msat;
|
||||
|
||||
/* Max amount of dust allowed per channel */
|
||||
struct amount_msat max_dust_htlc_exposure_msat;
|
||||
|
||||
@ -52,6 +56,9 @@ struct config {
|
||||
/* Are we allowed to use DNS lookup for peers. */
|
||||
bool use_dns;
|
||||
|
||||
/* Turn off IP address announcement discovered via peer `remote_addr` */
|
||||
bool disable_ip_discovery;
|
||||
|
||||
/* Minimal amount of effective funding_satoshis for accepting channels */
|
||||
u64 min_capacity_sat;
|
||||
|
||||
|
@ -147,7 +147,7 @@ void channel_config(struct lightningd *ld,
|
||||
= ld->config.max_dust_htlc_exposure_msat;
|
||||
|
||||
/* Don't care */
|
||||
ours->htlc_minimum = AMOUNT_MSAT(0);
|
||||
ours->htlc_minimum = ld->config.htlc_minimum_msat;
|
||||
|
||||
/* BOLT #2:
|
||||
*
|
||||
|
@ -211,8 +211,8 @@ wallet_commit_channel(struct lightningd *ld,
|
||||
take(new_height_states(NULL, uc->fc ? LOCAL : REMOTE,
|
||||
&lease_start_blockheight)),
|
||||
0, NULL, 0, 0, /* No leases on v1s */
|
||||
AMOUNT_MSAT(0), /* No htlc_minimum_msat */
|
||||
AMOUNT_MSAT(-1ULL)); /* No htlc_maximum_msat */
|
||||
ld->config.htlc_minimum_msat,
|
||||
ld->config.htlc_maximum_msat);
|
||||
|
||||
/* Now we finally put it in the database. */
|
||||
wallet_channel_insert(ld->wallet, channel);
|
||||
|
@ -760,6 +760,10 @@ static const struct config testnet_config = {
|
||||
/* Testnet blockspace is free. */
|
||||
.max_concurrent_htlcs = 483,
|
||||
|
||||
/* channel defaults for htlc min/max values */
|
||||
.htlc_minimum_msat = AMOUNT_MSAT(0),
|
||||
.htlc_maximum_msat = AMOUNT_MSAT(-1ULL), /* no limit */
|
||||
|
||||
/* Max amount of dust allowed per channel (50ksat) */
|
||||
.max_dust_htlc_exposure_msat = AMOUNT_MSAT(50000000),
|
||||
|
||||
@ -783,6 +787,9 @@ static const struct config testnet_config = {
|
||||
|
||||
.use_dns = true,
|
||||
|
||||
/* Turn off IP address announcement discovered via peer `remote_addr` */
|
||||
.disable_ip_discovery = false,
|
||||
|
||||
/* Sets min_effective_htlc_capacity - at 1000$/BTC this is 10ct */
|
||||
.min_capacity_sat = 10000,
|
||||
|
||||
@ -809,6 +816,10 @@ static const struct config mainnet_config = {
|
||||
/* While up to 483 htlcs are possible we do 30 by default (as eclair does) to save blockspace */
|
||||
.max_concurrent_htlcs = 30,
|
||||
|
||||
/* defaults for htlc min/max values */
|
||||
.htlc_minimum_msat = AMOUNT_MSAT(0),
|
||||
.htlc_maximum_msat = AMOUNT_MSAT(-1ULL), /* no limit */
|
||||
|
||||
/* Max amount of dust allowed per channel (50ksat) */
|
||||
.max_dust_htlc_exposure_msat = AMOUNT_MSAT(50000000),
|
||||
|
||||
@ -842,6 +853,9 @@ static const struct config mainnet_config = {
|
||||
|
||||
.use_dns = true,
|
||||
|
||||
/* Turn off IP address announcement discovered via peer `remote_addr` */
|
||||
.disable_ip_discovery = false,
|
||||
|
||||
/* Sets min_effective_htlc_capacity - at 1000$/BTC this is 10ct */
|
||||
.min_capacity_sat = 10000,
|
||||
|
||||
@ -1105,6 +1119,12 @@ 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("--htlc-minimum-msat", opt_set_msat, NULL,
|
||||
&ld->config.htlc_minimum_msat,
|
||||
"The default minimal value an HTLC must carry in order to be forwardable for new channels");
|
||||
opt_register_arg("--htlc-maximum-msat", opt_set_msat, NULL,
|
||||
&ld->config.htlc_maximum_msat,
|
||||
"The default maximal value an HTLC must carry in order to be forwardable for new channel");
|
||||
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");
|
||||
@ -1123,6 +1143,9 @@ static void register_opts(struct lightningd *ld)
|
||||
opt_register_arg("--announce-addr", opt_add_announce_addr, NULL,
|
||||
ld,
|
||||
"Set an IP address (v4 or v6) or .onion v3 to announce, but not listen on");
|
||||
opt_register_noarg("--disable-ip-discovery", opt_set_bool,
|
||||
&ld->config.disable_ip_discovery,
|
||||
"Turn off announcement of discovered public IPs");
|
||||
|
||||
opt_register_noarg("--offline", opt_set_offline, ld,
|
||||
"Start in offline-mode (do not automatically reconnect and do not accept incoming connections)");
|
||||
|
@ -1076,7 +1076,7 @@ static void update_remote_addr(struct lightningd *ld,
|
||||
const struct node_id peer_id)
|
||||
{
|
||||
/* failsafe to prevent privacy leakage. */
|
||||
if (ld->always_use_proxy)
|
||||
if (ld->always_use_proxy || ld->config.disable_ip_discovery)
|
||||
return;
|
||||
|
||||
switch (remote_addr->type) {
|
||||
|
Loading…
Reference in New Issue
Block a user