mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 09:40:19 +01:00
config: Allow overriding the transaction fee rate
This commit is contained in:
parent
6568083edd
commit
2b431b171b
3 changed files with 19 additions and 2 deletions
|
@ -485,7 +485,12 @@ u32 get_block_height(struct lightningd_state *dstate)
|
|||
|
||||
u64 get_feerate(struct lightningd_state *dstate)
|
||||
{
|
||||
if (dstate->topology->feerate == 0) {
|
||||
if (dstate->config.override_fee_rate) {
|
||||
log_debug(dstate->base_log,
|
||||
"Forcing fee rate, ignoring estimate");
|
||||
return dstate->config.override_fee_rate;
|
||||
}
|
||||
else if (dstate->topology->feerate == 0) {
|
||||
log_info(dstate->base_log,
|
||||
"No fee estimate: using default fee rate");
|
||||
return dstate->config.default_fee_rate;
|
||||
|
|
|
@ -127,6 +127,9 @@ static void config_register_opts(struct lightningd_state *dstate)
|
|||
opt_register_arg("--commit-fee=<percent>", opt_set_u32, opt_show_u32,
|
||||
&dstate->config.commitment_fee_percent,
|
||||
"Percentage of fee to request for their commitment");
|
||||
opt_register_arg("--override-fee-rate", opt_set_u64, opt_show_u64,
|
||||
&dstate->config.override_fee_rate,
|
||||
"Force a specific rate in satoshis per kb regardless of estimated fees");
|
||||
opt_register_arg("--default-fee-rate", opt_set_u64, opt_show_u64,
|
||||
&dstate->config.default_fee_rate,
|
||||
"Satoshis per kb if can't estimate fees");
|
||||
|
@ -198,6 +201,9 @@ static const struct config testnet_config = {
|
|||
/* We offer to pay 5 times 2-block fee */
|
||||
.commitment_fee_percent = 500,
|
||||
|
||||
/* Use this rate, if specified, regardless of what estimatefee says. */
|
||||
.override_fee_rate = 0,
|
||||
|
||||
/* Use this rate by default if estimatefee doesn't estimate. */
|
||||
.default_fee_rate = 40000,
|
||||
|
||||
|
@ -256,6 +262,9 @@ static const struct config mainnet_config = {
|
|||
/* We offer to pay 5 times 2-block fee */
|
||||
.commitment_fee_percent = 500,
|
||||
|
||||
/* Use this rate, if specified, regardless of what estimatefee says. */
|
||||
.override_fee_rate = 0,
|
||||
|
||||
/* Use this rate by default if estimatefee doesn't estimate. */
|
||||
.default_fee_rate = 40000,
|
||||
|
||||
|
|
|
@ -37,7 +37,10 @@ struct config {
|
|||
|
||||
/* Percent of fee rate we'll use. */
|
||||
u32 commitment_fee_percent;
|
||||
|
||||
|
||||
/* Force a partiular fee rate regardless of estimatefee (satoshis/kb) */
|
||||
u64 override_fee_rate;
|
||||
|
||||
/* What fee we use if estimatefee fails (satoshis/kb) */
|
||||
u64 default_fee_rate;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue