1
0

Format the transaction window fee rate with 1 decimal place (#4286)

* Fix format_satoshi to properly handle non-integer values

Handling the integer and fraction parts together via string formatting
simplifies the initial composition because the default behavior manages
the - sign, and the incorporation of the fractional part.

* Limit fee rate output to one decimal place

Via a new precision arg

* Introduce format_fee_satoshis and use it for all fee display
This commit is contained in:
Ben Woosley
2018-04-24 12:54:14 -04:00
committed by ghost43
parent a161b6e655
commit 53320470f5
6 changed files with 62 additions and 24 deletions

View File

@@ -7,7 +7,7 @@ import stat
from copy import deepcopy
from .util import (user_dir, print_error, PrintError,
NoDynamicFeeEstimates, format_satoshis)
NoDynamicFeeEstimates, format_fee_satoshis)
from .i18n import _
FEE_ETA_TARGETS = [25, 10, 5, 2]
@@ -367,7 +367,11 @@ class SimpleConfig(PrintError):
text is what we target: static fee / num blocks to confirm in / mempool depth
tooltip is the corresponding estimate (e.g. num blocks for a static fee)
"""
rate_str = (format_satoshis(fee_rate/1000, False, 0, 0, False) + ' sat/byte') if fee_rate is not None else 'unknown'
if fee_rate is None:
rate_str = 'unknown'
else:
rate_str = format_fee_satoshis(fee_rate/1000) + ' sat/byte'
if dyn:
if mempool:
depth = self.depth_target(pos)