Browse Source

fix get_payments

master
ThomasV 6 years ago
parent
commit
e05cd2006a
  1. 4
      electrum/gui/qt/channel_details.py
  2. 16
      electrum/lnchannel.py

4
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)

16
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:

Loading…
Cancel
Save