bitcoin.relayfee: minor clean-up

This commit is contained in:
SomberNight 2019-09-18 22:08:19 +02:00
parent 8c1adc2f50
commit e9a1c05d23
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9
2 changed files with 10 additions and 5 deletions

View file

@ -290,11 +290,15 @@ def add_number_to_script(i: int) -> bytes:
return bfh(push_script(script_num_to_hex(i)))
def relayfee(network: 'Network'=None) -> int:
from .simple_config import FEERATE_DEFAULT_RELAY
MAX_RELAY_FEE = 50000
f = network.relay_fee if network and network.relay_fee else FEERATE_DEFAULT_RELAY
return min(f, MAX_RELAY_FEE)
def relayfee(network: 'Network' = None) -> int:
from .simple_config import FEERATE_DEFAULT_RELAY, FEERATE_MAX_RELAY
if network and network.relay_fee is not None:
fee = network.relay_fee
else:
fee = FEERATE_DEFAULT_RELAY
fee = min(fee, FEERATE_MAX_RELAY)
fee = max(fee, 0)
return fee
def dust_threshold(network: 'Network'=None) -> int:

View file

@ -27,6 +27,7 @@ FEERATE_MAX_DYNAMIC = 1500000
FEERATE_WARNING_HIGH_FEE = 600000
FEERATE_FALLBACK_STATIC_FEE = 150000
FEERATE_DEFAULT_RELAY = 1000
FEERATE_MAX_RELAY = 50000
FEERATE_STATIC_VALUES = [1000, 2000, 5000, 10000, 20000, 30000,
50000, 70000, 100000, 150000, 200000, 300000]
FEERATE_REGTEST_HARDCODED = 180000 # for eclair compat