1
0

fix #2614: define non-linear scale for static fees

This commit is contained in:
ThomasV
2017-10-21 11:15:59 +02:00
parent 1d2253f0d8
commit 198cc9d737
4 changed files with 16 additions and 24 deletions

View File

@@ -41,6 +41,8 @@ class SimpleConfig(PrintError):
They are taken in order (1. overrides config options set in 2., that
override config set in 3.)
"""
fee_rates = [5000, 10000, 20000, 30000, 50000, 70000, 100000, 150000, 200000, 300000]
def __init__(self, options={}, read_system_config_function=None,
read_user_config_function=None, read_user_dir_function=None):
@@ -230,6 +232,13 @@ class SimpleConfig(PrintError):
min_target = -1
return min_target
def static_fee(self, i):
return self.fee_rates[i]
def static_fee_index(self, value):
dist = list(map(lambda x: abs(x - value), self.fee_rates))
return min(range(len(dist)), key=dist.__getitem__)
def has_fee_estimates(self):
return len(self.fee_estimates)==4