1
0

add close_channel method to peer

This commit is contained in:
ThomasV
2018-10-24 17:36:07 +02:00
parent f985aac8d1
commit 70dbd8e672
3 changed files with 42 additions and 5 deletions

View File

@@ -42,7 +42,6 @@ class ChannelsList(MyTreeWidget):
def create_menu(self, position):
menu = QMenu()
channel_id = self.currentItem().data(0, QtCore.Qt.UserRole)
print('ID', bh2u(channel_id))
def close():
netw = self.parent.network
coro = self.parent.wallet.lnworker.close_channel(channel_id)
@@ -50,7 +49,15 @@ class ChannelsList(MyTreeWidget):
_txid = netw.run_from_another_thread(coro)
except Exception as e:
self.main_window.show_error('Force-close failed:\n{}'.format(repr(e)))
menu.addAction(_("Force-close channel"), close)
def force_close():
netw = self.parent.network
coro = self.parent.wallet.lnworker.force_close_channel(channel_id)
try:
_txid = netw.run_from_another_thread(coro)
except Exception as e:
self.main_window.show_error('Force-close failed:\n{}'.format(repr(e)))
menu.addAction(_("Close channel"), close)
menu.addAction(_("Force-close channel"), force_close)
menu.exec_(self.viewport().mapToGlobal(position))
@QtCore.pyqtSlot(Channel)