qt LightningTxDialog: (fix regression) show fee for ln payments
follow-up e1d34300e5
This commit is contained in:
@@ -31,6 +31,7 @@ from PyQt5.QtGui import QFont
|
|||||||
from PyQt5.QtWidgets import QVBoxLayout, QLabel, QGridLayout
|
from PyQt5.QtWidgets import QVBoxLayout, QLabel, QGridLayout
|
||||||
|
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
|
from electrum.lnworker import PaymentDirection
|
||||||
|
|
||||||
from .util import WindowModalDialog, ButtonsLineEdit, ColorScheme, Buttons, CloseButton, MONOSPACE_FONT
|
from .util import WindowModalDialog, ButtonsLineEdit, ColorScheme, Buttons, CloseButton, MONOSPACE_FONT
|
||||||
from .qrtextedit import ShowQRTextEdit
|
from .qrtextedit import ShowQRTextEdit
|
||||||
@@ -46,7 +47,7 @@ class LightningTxDialog(WindowModalDialog):
|
|||||||
WindowModalDialog.__init__(self, parent, _("Lightning Payment"))
|
WindowModalDialog.__init__(self, parent, _("Lightning Payment"))
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.config = parent.config
|
self.config = parent.config
|
||||||
self.is_sent = bool(tx_item['direction'] == 'sent')
|
self.is_sent = tx_item['direction'] == PaymentDirection.SENT
|
||||||
self.label = tx_item['label']
|
self.label = tx_item['label']
|
||||||
self.timestamp = tx_item['timestamp']
|
self.timestamp = tx_item['timestamp']
|
||||||
self.amount = Decimal(tx_item['amount_msat']) / 1000
|
self.amount = Decimal(tx_item['amount_msat']) / 1000
|
||||||
@@ -67,8 +68,9 @@ class LightningTxDialog(WindowModalDialog):
|
|||||||
amount_str = self.parent.format_amount_and_units(self.amount, timestamp=self.timestamp)
|
amount_str = self.parent.format_amount_and_units(self.amount, timestamp=self.timestamp)
|
||||||
vbox.addWidget(QLabel(_("Amount") + f": {amount_str}"))
|
vbox.addWidget(QLabel(_("Amount") + f": {amount_str}"))
|
||||||
if self.is_sent:
|
if self.is_sent:
|
||||||
fee = Decimal(tx_item['fee_msat']) / 1000
|
fee_msat = tx_item['fee_msat']
|
||||||
fee_str = self.parent.format_amount_and_units(fee, timestamp=self.timestamp)
|
fee_sat = Decimal(fee_msat) / 1000 if fee_msat is not None else None
|
||||||
|
fee_str = self.parent.format_amount_and_units(fee_sat, timestamp=self.timestamp)
|
||||||
vbox.addWidget(QLabel(_("Fee") + f": {fee_str}"))
|
vbox.addWidget(QLabel(_("Fee") + f": {fee_str}"))
|
||||||
time_str = datetime.datetime.fromtimestamp(self.timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp(self.timestamp).isoformat(' ')[:-3]
|
||||||
vbox.addWidget(QLabel(_("Date") + ": " + time_str))
|
vbox.addWidget(QLabel(_("Date") + ": " + time_str))
|
||||||
|
|||||||
@@ -877,7 +877,7 @@ class LNWallet(LNWorker):
|
|||||||
'label': self.wallet.get_label_for_txid(funding_txid) or (_('Open channel') + ' ' + chan.get_id_for_log()),
|
'label': self.wallet.get_label_for_txid(funding_txid) or (_('Open channel') + ' ' + chan.get_id_for_log()),
|
||||||
'txid': funding_txid,
|
'txid': funding_txid,
|
||||||
'amount_msat': chan.balance(LOCAL, ctn=0),
|
'amount_msat': chan.balance(LOCAL, ctn=0),
|
||||||
'direction': 'received',
|
'direction': PaymentDirection.RECEIVED,
|
||||||
'timestamp': tx_height.timestamp,
|
'timestamp': tx_height.timestamp,
|
||||||
'date': timestamp_to_datetime(tx_height.timestamp),
|
'date': timestamp_to_datetime(tx_height.timestamp),
|
||||||
'fee_sat': None,
|
'fee_sat': None,
|
||||||
@@ -897,7 +897,7 @@ class LNWallet(LNWorker):
|
|||||||
'label': self.wallet.get_label_for_txid(closing_txid) or (_('Close channel') + ' ' + chan.get_id_for_log()),
|
'label': self.wallet.get_label_for_txid(closing_txid) or (_('Close channel') + ' ' + chan.get_id_for_log()),
|
||||||
'type': 'channel_closure',
|
'type': 'channel_closure',
|
||||||
'amount_msat': -chan.balance_minus_outgoing_htlcs(LOCAL),
|
'amount_msat': -chan.balance_minus_outgoing_htlcs(LOCAL),
|
||||||
'direction': 'sent',
|
'direction': PaymentDirection.SENT,
|
||||||
'timestamp': tx_height.timestamp,
|
'timestamp': tx_height.timestamp,
|
||||||
'date': timestamp_to_datetime(tx_height.timestamp),
|
'date': timestamp_to_datetime(tx_height.timestamp),
|
||||||
'fee_sat': None,
|
'fee_sat': None,
|
||||||
|
|||||||
Reference in New Issue
Block a user