Browse Source

wallet: dust limit calculation should round up (not down)

related to prev commit

closes #6035
hard-fail-on-bad-server-string
SomberNight 5 years ago
parent
commit
510399d3d2
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 8
      electrum/bitcoin.py

8
electrum/bitcoin.py

@ -299,6 +299,7 @@ def add_number_to_script(i: int) -> bytes:
def relayfee(network: 'Network' = None) -> int:
"""Returns feerate in sat/kbyte."""
from .simple_config import FEERATE_DEFAULT_RELAY, FEERATE_MAX_RELAY
if network and network.relay_fee is not None:
fee = network.relay_fee
@ -310,9 +311,12 @@ def relayfee(network: 'Network' = None) -> int:
return fee
def dust_threshold(network: 'Network'=None) -> int:
def dust_threshold(network: 'Network' = None) -> int:
"""Returns the dust limit in satoshis."""
# Change <= dust threshold is added to the tx fee
return 182 * 3 * relayfee(network) // 1000
dust_lim = 182 * 3 * relayfee(network) # in msat
# convert to sat, but round up:
return (dust_lim // 1000) + (dust_lim % 1000 > 0)
def hash_encode(x: bytes) -> str:

Loading…
Cancel
Save