commit 42df51f2dd606f4f18ba2cf27d5bcff07594a02e
parent b543874670c557b1443330d02a6a90af3d81737f
Author: bitromortac <bitromortac@protonmail.com>
Date: Tue, 13 Oct 2020 07:27:01 +0200
qt: remove node suggestion
Diffstat:
3 files changed, 5 insertions(+), 29 deletions(-)
diff --git a/electrum/gui/kivy/uix/dialogs/lightning_open_channel.py b/electrum/gui/kivy/uix/dialogs/lightning_open_channel.py
@@ -72,11 +72,6 @@ Builder.load_string('''
height: '48dp'
on_release: app.scan_qr(on_complete=s.on_qr)
Button:
- text: _('Suggest')
- size_hint: 1, None
- height: '48dp'
- on_release: s.choose_node()
- Button:
text: _('Clear')
size_hint: 1, None
height: '48dp'
@@ -102,11 +97,6 @@ class LightningOpenChannelDialog(Factory.Popup, Logger):
d = LabelDialog(_('IP/port in format:\n[host]:[port]'), self.ipport, callback)
d.open()
- def choose_node(self):
- suggested = self.app.wallet.lnworker.suggest_peer()
- if suggested:
- self.pubkey = suggested.hex()
-
def __init__(self, app, lnaddr=None, msg=None):
Factory.Popup.__init__(self)
Logger.__init__(self)
diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py
@@ -342,12 +342,8 @@ class ChannelsList(MyTreeView):
max_button = EnterButton(_("Max"), spend_max)
max_button.setFixedWidth(100)
max_button.setCheckable(True)
- suggest_button = QPushButton(d, text=_('Suggest'))
- def on_suggest():
- remote_nodeid.setText(bh2u(lnworker.suggest_peer() or b''))
- remote_nodeid.repaint() # macOS hack for #6269
- suggest_button.clicked.connect(on_suggest)
clear_button = QPushButton(d, text=_('Clear'))
+ clear_button.setFixedWidth(100)
def on_clear():
amount_e.setText('')
amount_e.setFrozen(False)
@@ -357,16 +353,16 @@ class ChannelsList(MyTreeView):
max_button.setChecked(False)
max_button.repaint() # macOS hack for #6269
clear_button.clicked.connect(on_clear)
+
h = QGridLayout()
h.addWidget(QLabel(_('Your Node ID')), 0, 0)
- h.addWidget(local_nodeid, 0, 1, 1, 3)
+ h.addWidget(local_nodeid, 0, 1, 1, 4)
h.addWidget(QLabel(_('Remote Node ID')), 1, 0)
- h.addWidget(remote_nodeid, 1, 1, 1, 3)
- h.addWidget(suggest_button, 2, 1)
- h.addWidget(clear_button, 2, 2)
+ h.addWidget(remote_nodeid, 1, 1, 1, 4)
h.addWidget(QLabel('Amount'), 3, 0)
h.addWidget(amount_e, 3, 1)
h.addWidget(max_button, 3, 2)
+ h.addWidget(clear_button, 3, 3)
vbox.addLayout(h)
ok_button = OkButton(d)
ok_button.setDefault(True)
diff --git a/electrum/lnworker.py b/electrum/lnworker.py
@@ -747,16 +747,6 @@ class LNWallet(LNWorker):
item['balance_msat'] = balance_msat
return out
- def suggest_peer(self):
- r = []
- for node_id, peer in self.peers.items():
- if not peer.is_initialized():
- continue
- if not all([chan.is_closed() for chan in peer.channels.values()]):
- continue
- r.append(node_id)
- return random.choice(r) if r else None
-
def channels_for_peer(self, node_id):
assert type(node_id) is bytes
return {chan_id: chan for (chan_id, chan) in self.channels.items()