Browse Source

opts: Add the max_fee_multiplier to specify acceptable fee ranges

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
0b427b4c3c
  1. 4
      lightningd/lightningd.h
  2. 13
      lightningd/options.c
  3. 5
      lightningd/peer_control.c

4
lightningd/lightningd.h

@ -60,6 +60,10 @@ struct config {
/* ipv6 bind disable */
bool no_ipv6_bind;
/* Accept fee changes only if they are in the range our_fee -
* our_fee*multiplier */
u32 max_fee_multiplier;
};
struct lightningd {

13
lightningd/options.c

@ -462,6 +462,13 @@ static void dev_register_opts(struct lightningd *ld)
opt_register_arg("--dev-bitcoind-poll", opt_set_u32, opt_show_u32,
&ld->topology->poll_seconds,
"Time between polling for new transactions");
opt_register_arg("--dev-max-fee-multiplier", opt_set_u32, opt_show_u32,
&ld->config.max_fee_multiplier,
"Allow the fee proposed by the remote end to be up to "
"multiplier times higher than our own. Small values "
"will cause channels to be closed more often due to "
"fee fluctuations, large values may result in large "
"fees.");
opt_register_arg("--dev-override-fee-rates", opt_set_fee_rates, NULL,
ld->topology,
"Force a specific rates (immediate/normal/slow) in satoshis per kw regardless of estimated fees");
@ -515,6 +522,9 @@ static const struct config testnet_config = {
/* Rescan 5 hours of blocks on testnet, it's reorg happy */
.rescan = 30,
/* Fees may be in the range our_fee - 10*our_fee */
.max_fee_multiplier = 5,
};
/* aka. "Dude, where's my coins?" */
@ -568,6 +578,9 @@ static const struct config mainnet_config = {
/* Rescan 2.5 hours of blocks on startup, it's not so reorg happy */
.rescan = 15,
/* Fees may be in the range our_fee - 10*our_fee */
.max_fee_multiplier = 5,
};
static void check_config(struct lightningd *ld)

5
lightningd/peer_control.c

@ -182,13 +182,14 @@ u32 feerate_min(struct lightningd *ld)
*
* Given the variance in fees, and the fact that the transaction may
* be spent in the future, it's a good idea for the fee payer to keep
* a good margin, say 5x the expected fee requirement */
* a good margin, say 10x the expected fee requirement */
u32 feerate_max(struct lightningd *ld)
{
if (ld->config.ignore_fee_limits)
return UINT_MAX;
return get_feerate(ld->topology, FEERATE_IMMEDIATE) * 5;
return get_feerate(ld->topology, FEERATE_IMMEDIATE) *
ld->config.max_fee_multiplier;
}
static void sign_last_tx(struct channel *channel)

Loading…
Cancel
Save