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

@@ -45,8 +45,8 @@ import sys
from .i18n import _
from .util import (NotEnoughFunds, PrintError, UserCancelled, profiler,
format_satoshis, NoDynamicFeeEstimates, TimeoutException,
WalletFileException, BitcoinException)
format_satoshis, format_fee_satoshis, NoDynamicFeeEstimates,
TimeoutException, WalletFileException, BitcoinException)
from .bitcoin import *
from .version import *
@@ -1169,7 +1169,7 @@ class Abstract_Wallet(PrintError):
if fee is not None:
size = tx.estimated_size()
fee_per_byte = fee / size
extra.append('%.1f sat/b'%(fee_per_byte))
extra.append(format_fee_satoshis(fee_per_byte) + ' sat/b')
if fee is not None and height in (TX_HEIGHT_UNCONF_PARENT, TX_HEIGHT_UNCONFIRMED) \
and self.network and self.network.config.has_fee_mempool():
exp_n = self.network.config.fee_to_depth(fee_per_byte)
@@ -2362,4 +2362,3 @@ class Wallet(object):
if wallet_type in wallet_constructors:
return wallet_constructors[wallet_type]
raise RuntimeError("Unknown wallet type: " + str(wallet_type))