Browse Source
new network API: use broadcast_transaction with run_from_other_thread
regtest_lnd
Janus
6 years ago
committed by
SomberNight
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
5 additions and
3 deletions
-
electrum/gui/qt/channels_list.py
-
electrum/lnworker.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) |
|
|
|
|
|
@ -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() |
|
|
|