mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 10:15:20 +00:00
wallet: dust limit calculation should round up (not down)
related to prev commit closes #6035
This commit is contained in:
parent
a500db371d
commit
510399d3d2
1 changed files with 6 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue