Skip to content
Snippets Groups Projects
Commit 470c6f97 authored by inso's avatar inso
Browse files

Bug fixes

Fixed a bug in broadcast
Fixed a bug in jsonification
parent c2cf392d
No related branches found
No related tags found
No related merge requests found
......@@ -7,3 +7,4 @@ noun_22441_cc.svg : Created by Bruno Castro
noun_29542_cc.svg : Created by Chris Kerr
noun_43022_cc.svg : Created by Jon Prepeluh
noun_63271_cc.svg : Created by Mark Shorter
noun_43022_cc.svg : Created by Piotrek Chuchla
<RCC>
<qresource prefix="icons">
<file alias="network_icon">noun_21549_cc.svg</file>
<file alias="informations_icon">iconmonstr-info-2-icon.svg</file>
<file alias="community_icon">noun_22441_cc.svg</file>
<file alias="wot_icon">noun_2651_cc.svg</file>
......
......@@ -273,12 +273,12 @@ class Community(object):
if not ok:
raise value_error
if tries == len(self.peers):
if tries == len(self.nodes):
raise NoPeerAvailable(self.currency, len(nodes))
def jsonify(self):
data = {'currency': self.currency,
'peers': self.network.jsonify()}
'peers': self._network.jsonify()}
return data
def get_parameters(self):
......
......@@ -39,6 +39,7 @@ class Network(QObject):
for data in json_data:
node = Node.from_json(currency, data)
nodes.append(node)
logging.debug("Loading : {:}".format(data['pubkey']))
block_max = max([n.block for n in nodes])
for node in nodes:
node.check_sync(currency, block_max)
......@@ -88,7 +89,7 @@ class Network(QObject):
last_inlines = [n.endpoint.inline() for n in self._nodes]
hash_new_nodes = hash(tuple(frozenset(sorted(new_inlines))))
hash_last_nodes= hash(tuple(frozenset(sorted(last_inlines))))
hash_last_nodes = hash(tuple(frozenset(sorted(last_inlines))))
if hash_new_nodes != hash_last_nodes:
self._nodes = nodes
......
......@@ -52,6 +52,14 @@ class Node(QObject):
node.refresh_state(currency)
return node
def jsonify(self):
data = {'pubkey': self._pubkey}
endpoints = []
for e in self._endpoints:
endpoints.append(e.inline())
data['endpoints'] = endpoints
return data
@property
def pubkey(self):
return self._pubkey
......
......@@ -134,7 +134,9 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
"Informations")
self.tab_network = NetworkTabWidget(self.community)
self.tabs_account.addTab(self.tab_network, "Network")
self.tabs_account.addTab(self.tab_network,
QIcon(":/icons/network_icon"),
"Network")
self.tab_informations.refresh()
blockid = self.community.current_blockid()
block_number = blockid['number']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment