mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 22:45:27 +01:00
opts: Add the max_fee_multiplier to specify acceptable fee ranges
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
4dca6daf34
commit
0b427b4c3c
3 changed files with 20 additions and 2 deletions
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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…
Add table
Reference in a new issue