diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py index 4826deb90..c10be384d 100644 --- a/electrum/gui/qt/channels_list.py +++ b/electrum/gui/qt/channels_list.py @@ -34,7 +34,9 @@ class ChannelsList(MyTreeWidget): channel_id = self.currentItem().data(0, QtCore.Qt.UserRole) print('ID', bh2u(channel_id)) def close(): - suc, msg = self.parent.wallet.lnworker.close_channel(channel_id) + netw = self.parent.network + coro = self.parent.wallet.lnworker.close_channel(channel_id) + suc, msg = netw.run_from_another_thread(coro) if not suc: self.main_window.show_error('Force-close failed:\n{}'.format(msg)) menu.addAction(_("Force-close channel"), close) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 07af808f4..c73ffa449 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -252,7 +252,7 @@ class LNWorker(PrintError): # we output the funding_outpoint instead of the channel_id because lnd uses channel_point (funding outpoint) to identify channels return [(chan.funding_outpoint.to_str(), chan.get_state()) for channel_id, chan in self.channels.items()] - def close_channel(self, chan_id): + async def close_channel(self, chan_id): chan = self.channels[chan_id] # local_commitment always gives back the next expected local_commitment, # but in this case, we want the current one. So substract one ctn number @@ -266,7 +266,7 @@ class LNWorker(PrintError): none_idx = tx._inputs[0]["signatures"].index(None) tx.add_signature_to_txin(0, none_idx, bh2u(remote_sig)) assert tx.is_complete() - return self.network.broadcast_transaction_from_non_network_thread(tx) + return await self.network.broadcast_transaction(tx) def _get_next_peers_to_try(self) -> Sequence[LNPeerAddr]: now = time.time()