mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-24 16:34:20 +01:00
Add option to scale median fee adjustment strategy
This commit is contained in:
committed by
Michael Schmoock
parent
e70a526a05
commit
b52afa1762
@@ -107,7 +107,7 @@ def get_fees_median(plugin: Plugin, scid: str):
|
||||
if len(channels_to_peer) == 0:
|
||||
return None
|
||||
fees_ppm = [ch['fee_per_millionth'] for ch in channels_to_peer]
|
||||
return {"base": plugin.adj_basefee, "ppm": statistics.median(fees_ppm)}
|
||||
return {"base": plugin.adj_basefee, "ppm": statistics.median(fees_ppm) * plugin.median_multiplier}
|
||||
|
||||
|
||||
def setchannelfee(plugin: Plugin, scid: str, base: int, ppm: int, min_htlc: int = None, max_htlc: int = None):
|
||||
@@ -309,6 +309,7 @@ def init(options: dict, configuration: dict, plugin: Plugin, **kwargs):
|
||||
"median": get_fees_median
|
||||
}
|
||||
plugin.fee_strategy = fee_strategy_switch.get(options.get("feeadjuster-feestrategy"), get_fees_global)
|
||||
plugin.median_multiplier = float(options.get("feeadjuster-median-multiplier"))
|
||||
config = plugin.rpc.listconfigs()
|
||||
plugin.adj_basefee = config["fee-base"]
|
||||
plugin.adj_ppmfee = config["fee-per-satoshi"]
|
||||
@@ -406,6 +407,14 @@ plugin.add_option(
|
||||
"Default: 'global'.",
|
||||
"string"
|
||||
)
|
||||
plugin.add_option(
|
||||
"feeadjuster-median-multiplier",
|
||||
"1.0",
|
||||
"Sets the factor with which the median fee is multiplied if using the fee strategy 'median'. "
|
||||
"This allows over or underbidding other nodes by a constant factor"
|
||||
"Default: '1.0'.",
|
||||
"string"
|
||||
)
|
||||
plugin.add_option(
|
||||
"feeadjuster-max-htlc-steps",
|
||||
"0",
|
||||
|
||||
Reference in New Issue
Block a user