commit e05cd2006a91c37b7a0bfd33b271db3106b24741
parent d1fc4399e627fd1945db51f0dbd74ddafc695471
Author: ThomasV <thomasv@electrum.org>
Date: Tue, 18 Feb 2020 17:40:13 +0100
fix get_payments
Diffstat:
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/electrum/gui/qt/channel_details.py b/electrum/gui/qt/channel_details.py
@@ -54,8 +54,8 @@ class ChannelDetailsDialog(QtWidgets.QDialog):
self.folders[keyname] = folder
mapping = {}
num = 0
- for pay_hash, item in htlcs.items():
- chan_id, i, direction, status = item
+ for item in htlcs:
+ pay_hash, chan_id, i, direction, status = item
if status != keyname:
continue
it = self.make_htlc_item(i, direction)
diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py
@@ -246,6 +246,22 @@ class Channel(Logger):
def get_next_feerate(self, subject):
return self.hm.get_feerate_in_next_ctx(subject)
+ def get_payments(self):
+ out = []
+ for subject in LOCAL, REMOTE:
+ log = self.hm.log[subject]
+ for htlc_id, htlc in log.get('adds', {}).items():
+ if htlc_id in log.get('fails',{}):
+ status = 'failed'
+ elif htlc_id in log.get('settles',{}):
+ status = 'settled'
+ else:
+ status = 'inflight'
+ direction = SENT if subject is LOCAL else RECEIVED
+ rhash = bh2u(htlc.payment_hash)
+ out.append((rhash, self.channel_id, htlc, direction, status))
+ return out
+
def get_settled_payments(self):
out = {}
for subject in LOCAL, REMOTE: