mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
new network API: use broadcast_transaction with run_from_other_thread
This commit is contained in:
parent
11a528c68a
commit
ef67f1e18a
2 changed files with 5 additions and 3 deletions
|
@ -34,7 +34,9 @@ class ChannelsList(MyTreeWidget):
|
||||||
channel_id = self.currentItem().data(0, QtCore.Qt.UserRole)
|
channel_id = self.currentItem().data(0, QtCore.Qt.UserRole)
|
||||||
print('ID', bh2u(channel_id))
|
print('ID', bh2u(channel_id))
|
||||||
def close():
|
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:
|
if not suc:
|
||||||
self.main_window.show_error('Force-close failed:\n{}'.format(msg))
|
self.main_window.show_error('Force-close failed:\n{}'.format(msg))
|
||||||
menu.addAction(_("Force-close channel"), close)
|
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
|
# 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()]
|
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]
|
chan = self.channels[chan_id]
|
||||||
# local_commitment always gives back the next expected local_commitment,
|
# local_commitment always gives back the next expected local_commitment,
|
||||||
# but in this case, we want the current one. So substract one ctn number
|
# 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)
|
none_idx = tx._inputs[0]["signatures"].index(None)
|
||||||
tx.add_signature_to_txin(0, none_idx, bh2u(remote_sig))
|
tx.add_signature_to_txin(0, none_idx, bh2u(remote_sig))
|
||||||
assert tx.is_complete()
|
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]:
|
def _get_next_peers_to_try(self) -> Sequence[LNPeerAddr]:
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
|
Loading…
Add table
Reference in a new issue