1
0

lnchan: add available_to_spend()

This commit is contained in:
Janus
2018-10-17 20:01:45 +02:00
committed by ThomasV
parent d317bdbd9b
commit ac68c8f531
3 changed files with 18 additions and 5 deletions

View File

@@ -23,10 +23,19 @@ class ChannelsList(MyTreeWidget):
self.status = QLabel('')
def format_fields(self, chan):
labels = {}
for subject in (REMOTE, LOCAL):
available = chan.available_to_spend(subject)//1000
label = self.parent.format_amount(available)
bal_other = chan.balance(-subject)//1000
available_other = chan.available_to_spend(-subject)//1000
if bal_other != available_other:
label += ' (+' + self.parent.format_amount(bal_other - available_other) + ')'
labels[subject] = label
return [
bh2u(chan.node_id),
self.parent.format_amount(chan.balance(LOCAL)//1000),
self.parent.format_amount(chan.balance(REMOTE)//1000),
labels[LOCAL],
labels[REMOTE],
chan.get_state()
]