globalvars.py: make 'tx_fee_adj' a float
This commit is contained in:
parent
af5770b8e9
commit
7e158a9bcf
2 changed files with 7 additions and 6 deletions
|
|
@ -21,7 +21,6 @@ globalvars.py: Constants and configuration options for the MMGen suite
|
|||
"""
|
||||
|
||||
import sys,os
|
||||
from decimal import Decimal
|
||||
from collections import namedtuple
|
||||
from .devtools import *
|
||||
|
||||
|
|
@ -69,7 +68,7 @@ class GlobalContext(Lockable):
|
|||
dfl_hash_preset = '3'
|
||||
usr_randchars = 30
|
||||
|
||||
tx_fee_adj = Decimal('1.0')
|
||||
tx_fee_adj = 1.0
|
||||
tx_confs = 3
|
||||
|
||||
# Constant vars - some of these might be overridden in opts.py, but they don't change thereafter
|
||||
|
|
|
|||
10
mmgen/tx.py
10
mmgen/tx.py
|
|
@ -631,14 +631,16 @@ class MMGenTX:
|
|||
|
||||
# given network fee estimate in BTC/kB, return absolute fee using estimated tx size
|
||||
def fee_est2abs(self,fee_per_kb,fe_type=None):
|
||||
from decimal import Decimal
|
||||
tx_size = self.estimate_size()
|
||||
f = fee_per_kb * opt.tx_fee_adj * tx_size / 1024
|
||||
ret = self.proto.coin_amt(f,from_decimal=True)
|
||||
ret = self.proto.coin_amt(
|
||||
Decimal(fee_per_kb * opt.tx_fee_adj * tx_size / 1024),
|
||||
from_decimal = True )
|
||||
if opt.verbose:
|
||||
msg(fmt(f"""
|
||||
{fe_type.upper()} fee for {opt.tx_confs} confirmations: {fee_per_kb} {self.coin}/kB
|
||||
TX size (estimated): {tx_size} bytes
|
||||
Fee adjustment factor: {opt.tx_fee_adj}
|
||||
Fee adjustment factor: {opt.tx_fee_adj:.2f}
|
||||
Absolute fee (fee_per_kb * adj_factor * tx_size / 1024): {ret} {self.coin}
|
||||
""").strip())
|
||||
return ret
|
||||
|
|
@ -684,7 +686,7 @@ class MMGenTX:
|
|||
if abs_fee:
|
||||
prompt = '{} TX fee{}: {}{} {} ({} {})\n'.format(
|
||||
desc,
|
||||
(f' (after {opt.tx_fee_adj}X adjustment)'
|
||||
(f' (after {opt.tx_fee_adj:.2f}X adjustment)'
|
||||
if opt.tx_fee_adj != 1 and desc.startswith('Network-estimated')
|
||||
else ''),
|
||||
('','≈')[self.fee_is_approximate],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue