|
|
@ -29,7 +29,7 @@ from typing import Sequence |
|
|
|
from PyQt5.QtCore import Qt, QItemSelectionModel |
|
|
|
from PyQt5.QtGui import QStandardItemModel, QStandardItem |
|
|
|
from PyQt5.QtWidgets import QAbstractItemView |
|
|
|
from PyQt5.QtWidgets import QMenu, QVBoxLayout, QTreeWidget, QTreeWidgetItem |
|
|
|
from PyQt5.QtWidgets import QMenu, QVBoxLayout, QTreeWidget, QTreeWidgetItem, QHeaderView |
|
|
|
|
|
|
|
from electrum.i18n import _ |
|
|
|
from electrum.util import format_time, PR_UNPAID, PR_PAID, PR_INFLIGHT, PR_FAILED |
|
|
@ -173,32 +173,15 @@ class InvoiceList(MyTreeView): |
|
|
|
|
|
|
|
def show_log(self, key, log: Sequence[PaymentAttemptLog]): |
|
|
|
d = WindowModalDialog(self, _("Payment log")) |
|
|
|
d.setMinimumWidth(800) |
|
|
|
d.setMinimumWidth(600) |
|
|
|
vbox = QVBoxLayout(d) |
|
|
|
log_w = QTreeWidget() |
|
|
|
log_w.setHeaderLabels([_('Route'), _('Channel ID'), _('Message'), _('Blacklist')]) |
|
|
|
log_w.setHeaderLabels([_('Hops'), _('Channel ID'), _('Message')]) |
|
|
|
log_w.header().setSectionResizeMode(2, QHeaderView.Stretch) |
|
|
|
log_w.header().setSectionResizeMode(1, QHeaderView.ResizeToContents) |
|
|
|
for payment_attempt_log in log: |
|
|
|
if not payment_attempt_log.exception: |
|
|
|
route = payment_attempt_log.route |
|
|
|
route_str = '%d'%len(route) |
|
|
|
if not payment_attempt_log.success: |
|
|
|
sender_idx = payment_attempt_log.failure_details.sender_idx |
|
|
|
failure_msg = payment_attempt_log.failure_details.failure_msg |
|
|
|
blacklist_msg = str(payment_attempt_log.failure_details.is_blacklisted) |
|
|
|
short_channel_id = route[sender_idx+1].short_channel_id |
|
|
|
data = failure_msg.data |
|
|
|
message = repr(failure_msg.code) |
|
|
|
else: |
|
|
|
short_channel_id = route[-1].short_channel_id |
|
|
|
message = _('Success') |
|
|
|
blacklist_msg = str(False) |
|
|
|
chan_str = str(short_channel_id) |
|
|
|
else: |
|
|
|
route_str = 'None' |
|
|
|
chan_str = 'N/A' |
|
|
|
message = str(payment_attempt_log.exception) |
|
|
|
blacklist_msg = 'N/A' |
|
|
|
x = QTreeWidgetItem([route_str, chan_str, message, blacklist_msg]) |
|
|
|
route_str, chan_str, message = payment_attempt_log.formatted_tuple() |
|
|
|
x = QTreeWidgetItem([route_str, chan_str, message]) |
|
|
|
log_w.addTopLevelItem(x) |
|
|
|
vbox.addWidget(log_w) |
|
|
|
vbox.addLayout(Buttons(CloseButton(d))) |
|
|
|