feat: add min_capacity_sat config value and switch

- add config value min_capacity_sat that will replaces the magic value
  min_effective_htlc_capacity = AMOUNT_MSAT(1000000)
- add config switch min_capacity_sat
This commit is contained in:
Michael Schmoock
2019-04-03 10:20:38 +02:00
committed by Christian Decker
parent 41dd975aac
commit c7af0c93c9
4 changed files with 17 additions and 2 deletions

View File

@@ -67,6 +67,9 @@ struct config {
/* Are we allowed to use DNS lookup for peers. */
bool use_dns;
/* Minimal amount of effective funding_satoshis for accepting channels */
u64 min_capacity_sat;
};
struct lightningd {

View File

@@ -662,8 +662,10 @@ static void channel_config(struct lightningd *ld,
{
/* FIXME: depend on feerate. */
*max_to_self_delay = ld->config.locktime_max;
/* This is 1c at $1000/BTC */
*min_effective_htlc_capacity = AMOUNT_MSAT(1000000);
/* Take minimal effective capacity from config min_capacity_sat */
amount_msat_from_sat_u64(min_effective_htlc_capacity,
ld->config.min_capacity_sat);
/* BOLT #2:
*

View File

@@ -376,6 +376,9 @@ static void config_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("--min-capacity-sat", opt_set_u64, opt_show_u64,
&ld->config.min_capacity_sat,
"Minimum capacity in satoshis for accepting channels");
opt_register_arg("--addr", opt_add_addr, NULL,
ld,
"Set an IP address (v4 or v6) to listen on and announce to the network for incoming connections");
@@ -544,6 +547,9 @@ static const struct config testnet_config = {
.max_fee_multiplier = 10,
.use_dns = true,
/* Sets min_effective_htlc_capacity - at 1000$/BTC this is 1ct */
.min_capacity_sat = 1000,
};
/* aka. "Dude, where's my coins?" */
@@ -607,6 +613,9 @@ static const struct config mainnet_config = {
.max_fee_multiplier = 10,
.use_dns = true,
/* Sets min_effective_htlc_capacity - at 1000$/BTC this is 1ct */
.min_capacity_sat = 1000,
};
static void check_config(struct lightningd *ld)

View File

@@ -22,4 +22,5 @@ const struct config test_config = {
.rescan = 30,
.max_fee_multiplier = 10,
.use_dns = true,
.min_capacity_sat = 1000,
};