|
@ -593,7 +593,7 @@ class LNWallet(LNWorker): |
|
|
for chan in self.channels.values(): |
|
|
for chan in self.channels.values(): |
|
|
d = chan.get_settled_payments() |
|
|
d = chan.get_settled_payments() |
|
|
for k, v in d.items(): |
|
|
for k, v in d.items(): |
|
|
out[k].append(v) |
|
|
out[k] += v |
|
|
return out |
|
|
return out |
|
|
|
|
|
|
|
|
def get_lightning_history(self): |
|
|
def get_lightning_history(self): |
|
@ -601,26 +601,21 @@ class LNWallet(LNWorker): |
|
|
for key, plist in self.get_settled_payments().items(): |
|
|
for key, plist in self.get_settled_payments().items(): |
|
|
if len(plist) == 0: |
|
|
if len(plist) == 0: |
|
|
continue |
|
|
continue |
|
|
elif len(plist) == 1: |
|
|
payment_hash = bytes.fromhex(key) |
|
|
chan_id, htlc, _direction = plist[0] |
|
|
info = self.get_payment_info(payment_hash) |
|
|
direction = 'sent' if _direction == SENT else 'received' |
|
|
timestamp = min([htlc.timestamp for chan_id, htlc, _direction in plist]) |
|
|
amount_msat = int(_direction) * htlc.amount_msat |
|
|
amount_msat = 0 |
|
|
timestamp = htlc.timestamp |
|
|
fee_msat = None |
|
|
|
|
|
for chan_id, htlc, _direction in plist: |
|
|
|
|
|
amount_msat += int(_direction) * htlc.amount_msat |
|
|
|
|
|
if _direction == SENT and info and info.amount: |
|
|
|
|
|
fee_msat = (fee_msat or 0) - info.amount*1000 - amount_msat |
|
|
|
|
|
if info is not None: |
|
|
label = self.wallet.get_label(key) |
|
|
label = self.wallet.get_label(key) |
|
|
if _direction == SENT: |
|
|
direction = ('sent' if info.direction == SENT else 'received') if len(plist)==1 else 'self-payment' |
|
|
info = self.get_payment_info(bfh(key)) |
|
|
|
|
|
fee_msat = - info.amount*1000 - amount_msat if info and info.amount else None |
|
|
|
|
|
else: |
|
|
|
|
|
fee_msat = None |
|
|
|
|
|
else: |
|
|
else: |
|
|
# assume forwarding |
|
|
|
|
|
direction = 'forwarding' |
|
|
direction = 'forwarding' |
|
|
amount_msat = sum([int(_direction) * htlc.amount_msat for chan_id, htlc, _direction in plist]) |
|
|
|
|
|
label = _('Forwarding') |
|
|
label = _('Forwarding') |
|
|
timestamp = min([htlc.timestamp for chan_id, htlc, _direction in plist]) |
|
|
|
|
|
fee_msat = None # fixme |
|
|
|
|
|
|
|
|
|
|
|
payment_hash = bytes.fromhex(key) |
|
|
|
|
|
preimage = self.get_preimage(payment_hash).hex() |
|
|
preimage = self.get_preimage(payment_hash).hex() |
|
|
item = { |
|
|
item = { |
|
|
'type': 'payment', |
|
|
'type': 'payment', |
|
|