Browse Source

qt: remove node suggestion

patch-4
bitromortac 4 years ago
committed by ThomasV
parent
commit
42df51f2dd
  1. 10
      electrum/gui/kivy/uix/dialogs/lightning_open_channel.py
  2. 14
      electrum/gui/qt/channels_list.py
  3. 10
      electrum/lnworker.py

10
electrum/gui/kivy/uix/dialogs/lightning_open_channel.py

@ -71,11 +71,6 @@ Builder.load_string('''
size_hint: 0.5, None
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
@ -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)

14
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)

10
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()

Loading…
Cancel
Save