electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit e9a1c05d230b0bb6f736385cd9a552bd6d239025
parent 8c1adc2f50a79687b71c8e47142569196a91b758
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed, 18 Sep 2019 22:08:19 +0200

bitcoin.relayfee: minor clean-up

Diffstat:
Melectrum/bitcoin.py | 14+++++++++-----
Melectrum/simple_config.py | 1+
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/electrum/bitcoin.py b/electrum/bitcoin.py @@ -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: diff --git a/electrum/simple_config.py b/electrum/simple_config.py @@ -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