electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 8285bc458f28d265ce50f83ce3a306a9003d22af
parent 6931ffada55087c481b9d098afa5d0fa8c1794ec
Author: ThomasV <thomasv@electrum.org>
Date:   Fri, 23 Jun 2017 10:36:49 +0200

network dialog: show servers in blockchain tab

Diffstat:
Mgui/qt/network_dialog.py | 24++++++++++++++++--------
Mlib/network.py | 1+
2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/gui/qt/network_dialog.py b/gui/qt/network_dialog.py @@ -208,18 +208,26 @@ class NetworkChoiceLayout(object): grid.addWidget(QLabel(height_str), 1, 1) grid.addWidget(HelpButton(msg), 1, 4) else: - checkpoint = network.get_checkpoint() self.cph_label = QLabel(_('Chain split detected')) grid.addWidget(self.cph_label, 4, 0) - chains_list_widget = QTreeWidget() - chains_list_widget.setHeaderLabels( [ _('Nodes'), _('Blocks'), _('Checkpoint'), _('Hash') ] ) - chains_list_widget.setMaximumHeight(150) - grid.addWidget(chains_list_widget, 5, 0, 1, 5) + + chains_list_widget = QTreeWidget() + chains_list_widget.setHeaderLabels( [ _('Height'), _('Server') ] ) + grid.addWidget(chains_list_widget, 5, 0, 1, 5) + if n_chains> 1: + checkpoint = network.get_checkpoint() for b in network.blockchains.values(): _hash = b.get_hash(checkpoint) - height = b.height() - count = sum([i.blockchain == b for i in network.interfaces.values()]) - chains_list_widget.addTopLevelItem(QTreeWidgetItem( [ '%d'%count, '%d'%height, '%d'%checkpoint, _hash ] )) + x = QTreeWidgetItem([ '%d'%checkpoint, _hash ]) + for i in network.interfaces.values(): + if i.blockchain == b: + x.addChild(QTreeWidgetItem(['%d'%i.tip, i.host])) + chains_list_widget.addTopLevelItem(x) + x.setExpanded(True) + else: + for i in network.interfaces.values(): + chains_list_widget.addTopLevelItem(QTreeWidgetItem(['%d'%i.tip, i.host])) + chains_list_widget.header().setResizeMode(0, QHeaderView.ResizeToContents) grid.setRowStretch(7, 1) vbox = QVBoxLayout() diff --git a/lib/network.py b/lib/network.py @@ -719,6 +719,7 @@ class Network(util.DaemonThread): self.add_recent_server(server) interface = Interface(server, socket) interface.blockchain = None + interface.tip = 0 interface.mode = 'checkpoint' self.interfaces[server] = interface self.request_header(interface, self.get_checkpoint())