mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
do not block GUI with open_channel
This commit is contained in:
parent
3dc8c08f6b
commit
2f35212446
5 changed files with 8 additions and 9 deletions
|
@ -747,7 +747,8 @@ class Commands:
|
|||
# lightning network commands
|
||||
@command('wpn')
|
||||
def open_channel(self, node_id, amount, channel_push=0, password=None):
|
||||
self.wallet.lnworker.open_channel(node_id, satoshis(amount), satoshis(channel_push), password)
|
||||
f = self.wallet.lnworker.open_channel(node_id, satoshis(amount), satoshis(channel_push), password)
|
||||
return f.result()
|
||||
|
||||
@command('wn')
|
||||
def reestablish_channel(self):
|
||||
|
|
|
@ -26,10 +26,10 @@ class ChannelsList(MyTreeWidget):
|
|||
|
||||
def create_menu(self, position):
|
||||
menu = QtWidgets.QMenu()
|
||||
cur = self.currentItem()
|
||||
print('ID', bh2u(cur.data(0, QtCore.Qt.UserRole)))
|
||||
channel_id = self.currentItem().data(0, QtCore.Qt.UserRole)
|
||||
print('ID', bh2u(channel_id))
|
||||
def close():
|
||||
print("closechannel result", self.parent.wallet.lnworker.close_channel_from_other_thread(cur.di))
|
||||
self.parent.wallet.lnworker.close_channel(channel_id)
|
||||
menu.addAction(_("Close channel"), close)
|
||||
menu.exec_(self.viewport().mapToGlobal(position))
|
||||
|
||||
|
|
|
@ -582,7 +582,6 @@ class Peer(PrintError):
|
|||
self.privkey = lnworker.privkey
|
||||
self.network = lnworker.network
|
||||
self.channel_db = lnworker.channel_db
|
||||
self.path_finder = lnworker.path_finder
|
||||
self.channel_state = lnworker.channel_state
|
||||
self.read_buffer = b''
|
||||
self.ping_time = 0
|
||||
|
|
|
@ -180,8 +180,7 @@ class LNWorker(PrintError):
|
|||
|
||||
def open_channel(self, node_id, local_amt_sat, push_amt_sat, pw):
|
||||
coro = self._open_channel_coroutine(node_id, local_amt_sat, push_amt_sat, None if pw == "" else pw)
|
||||
# FIXME this is blocking the GUI
|
||||
return asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop).result()
|
||||
return asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop)
|
||||
|
||||
def pay(self, invoice):
|
||||
addr = lndecode(invoice, expected_hrp=constants.net.SEGWIT_HRP)
|
||||
|
|
|
@ -5,8 +5,8 @@ import unittest
|
|||
from lib.util import bh2u, bfh
|
||||
from lib.lnbase import make_commitment, get_obscured_ctn, Peer, make_offered_htlc, make_received_htlc, make_htlc_tx
|
||||
from lib.lnbase import secret_to_pubkey, derive_pubkey, derive_privkey, derive_blinded_pubkey, overall_weight
|
||||
from lib.lnbase import make_htlc_tx_output, make_htlc_tx_inputs, get_per_commitment_secret_from_seed
|
||||
from lib.lnbase import make_htlc_tx_witness, OnionHopsDataSingle, new_onion_packet, OnionPerHop
|
||||
from lib.lnbase import make_htlc_tx_output, make_htlc_tx_inputs, get_per_commitment_secret_from_seed, make_htlc_tx_witness
|
||||
from lib.lnrouter import OnionHopsDataSingle, new_onion_packet, OnionPerHop
|
||||
from lib.lnbase import RevocationStore
|
||||
from lib.transaction import Transaction
|
||||
from lib import bitcoin
|
||||
|
|
Loading…
Add table
Reference in a new issue