mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-24 08:34:18 +01:00
feeadjuster: fix typos
This commit is contained in:
committed by
Christian Decker
parent
b7804408f4
commit
9809cc2dfd
@@ -10,7 +10,7 @@ plugin.adj_balances = {}
|
||||
# Cache to avoid loads of calls to getinfo
|
||||
plugin.our_node_id = None
|
||||
# Users can configure this
|
||||
plugin.update_treshold = 0.05
|
||||
plugin.update_threshold = 0.05
|
||||
|
||||
|
||||
def get_ratio(our_percentage):
|
||||
@@ -30,12 +30,12 @@ def maybe_adjust_fees(plugin: Plugin, scids: list):
|
||||
|
||||
# Only update on substantial balance moves to avoid flooding, and add
|
||||
# some pseudo-randomness to avoid too easy channel balance probing
|
||||
update_treshold = plugin.update_treshold
|
||||
update_threshold = plugin.update_threshold
|
||||
if not plugin.deactivate_fuzz:
|
||||
update_treshold += random.uniform(-0.015, 0.015)
|
||||
update_threshold += random.uniform(-0.015, 0.015)
|
||||
|
||||
if (last_percentage is None
|
||||
or abs(last_percentage - percentage) > update_treshold):
|
||||
or abs(last_percentage - percentage) > update_threshold):
|
||||
ratio = get_ratio(percentage)
|
||||
try:
|
||||
plugin.rpc.setchannelfee(scid, int(plugin.adj_basefee * ratio),
|
||||
@@ -100,7 +100,7 @@ def forward_event(plugin: Plugin, forward_event: dict, **kwargs):
|
||||
def init(options: dict, configuration: dict, plugin: Plugin, **kwargs):
|
||||
plugin.our_node_id = plugin.rpc.getinfo()["id"]
|
||||
plugin.deactivate_fuzz = options.get("feeadjuster-deactivate-fuzz", False)
|
||||
plugin.update_treshold = float(options.get("feeadjuster-threshold", "0.05"))
|
||||
plugin.update_threshold = float(options.get("feeadjuster-threshold", "0.05"))
|
||||
config = plugin.rpc.listconfigs()
|
||||
plugin.adj_basefee = config["fee-base"]
|
||||
plugin.adj_ppmfee = config["fee-per-satoshi"]
|
||||
@@ -117,7 +117,7 @@ def init(options: dict, configuration: dict, plugin: Plugin, **kwargs):
|
||||
plugin.log("Plugin feeadjuster initialized ({} base / {} ppm) with a "
|
||||
"threshold of {}"
|
||||
.format(plugin.adj_basefee, plugin.adj_ppmfee,
|
||||
plugin.update_treshold))
|
||||
plugin.update_threshold))
|
||||
|
||||
|
||||
plugin.add_option(
|
||||
@@ -129,8 +129,8 @@ plugin.add_option(
|
||||
plugin.add_option(
|
||||
"feeadjuster-threshold",
|
||||
"0.05",
|
||||
"Channel balance update threshold at which to trigger an update. Note "
|
||||
"it's fuzzed.",
|
||||
"Channel balance update threshold at which to trigger an update. "
|
||||
"Note: it's also fuzzed by 1.5%",
|
||||
"string"
|
||||
)
|
||||
plugin.run()
|
||||
|
||||
Reference in New Issue
Block a user