commit 31edc419fabe408f1eb980736ec52916a3b39373
parent 355bd322df29b2cecd64a5e37fe294190aaa4661
Author: ThomasV <thomasv@electrum.org>
Date: Tue, 27 Feb 2018 15:13:44 +0100
improve get_tx_status
Diffstat:
3 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py
@@ -89,10 +89,9 @@ class CScreen(Factory.Screen):
# note: this list needs to be kept in sync with another in qt
TX_ICONS = [
- "close",
- "close",
"unconfirmed",
"close",
+ "unconfirmed",
"close",
"clock1",
"clock2",
diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py
@@ -38,9 +38,8 @@ except:
# note: this list needs to be kept in sync with another in kivy
TX_ICONS = [
- "warning.png",
- "warning.png",
"unconfirmed.png",
+ "warning.png",
"unconfirmed.png",
"offline_tx.png",
"clock1.png",
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -65,9 +65,8 @@ from .paymentrequest import InvoiceStore
from .contacts import Contacts
TX_STATUS = [
- _('Replaceable'),
- _('Unconfirmed parent'),
_('Unconfirmed'),
+ _('Unconfirmed parent'),
_('Not Verified'),
_('Local'),
]
@@ -588,10 +587,10 @@ class Abstract_Wallet(PrintError):
status = _('Unconfirmed')
if fee is None:
fee = self.tx_fees.get(tx_hash)
- if fee and self.network.config.has_fee_etas():
+ if fee and self.network.config.has_fee_mempool():
size = tx.estimated_size()
- fee_per_kb = fee * 1000 / size
- exp_n = self.network.config.fee_to_eta(fee_per_kb)
+ fee_per_byte = fee / size
+ exp_n = self.network.config.fee_to_depth(fee_per_byte)
can_bump = is_mine and not tx.is_final()
else:
status = _('Local')
@@ -1102,33 +1101,40 @@ class Abstract_Wallet(PrintError):
def get_tx_status(self, tx_hash, height, conf, timestamp):
from .util import format_time
- exp_n = False
+ extra = []
if conf == 0:
tx = self.transactions.get(tx_hash)
if not tx:
return 2, 'unknown'
is_final = tx and tx.is_final()
- fee = self.tx_fees.get(tx_hash)
- if fee and self.network and self.network.config.has_fee_mempool():
+ if not is_final:
+ extra.append('rbf')
+ fee = self.get_wallet_delta(tx)[3]
+ if fee is None:
+ fee = self.tx_fees.get(tx_hash)
+ if fee is not None:
size = tx.estimated_size()
- fee_per_kb = fee * 1000 / size
- exp_n = self.network.config.fee_to_depth(fee_per_kb//1000)
+ fee_per_byte = fee / size
+ extra.append('%.1f sat/b'%(fee_per_byte))
+ 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)
+ if exp_n:
+ extra.append('%.2f MB'%(exp_n/1000000))
if height == TX_HEIGHT_LOCAL:
- status = 4
+ status = 3
elif height == TX_HEIGHT_UNCONF_PARENT:
status = 1
- elif height == TX_HEIGHT_UNCONFIRMED and not is_final:
- status = 0
elif height == TX_HEIGHT_UNCONFIRMED:
- status = 2
+ status = 0
else:
- status = 3
+ status = 2
else:
- status = 4 + min(conf, 6)
+ status = 3 + min(conf, 6)
time_str = format_time(timestamp) if timestamp else _("unknown")
- status_str = TX_STATUS[status] if status < 5 else time_str
- if exp_n:
- status_str += ' [%d sat/b, %.2f MB]'%(fee_per_kb//1000, exp_n/1000000)
+ status_str = TX_STATUS[status] if status < 4 else time_str
+ if extra:
+ status_str += ' [%s]'%(', '.join(extra))
return status, status_str
def relayfee(self):