ThomasV
7 years ago
committed by
SomberNight
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
5 changed files with
8 additions and
9 deletions
-
electrum/commands.py
-
gui/qt/channels_list.py
-
lib/lnbase.py
-
lib/lnworker.py
-
lib/tests/test_lnbase.py
|
|
@ -770,7 +770,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 |
|
|
|