Skip to content

Commit

Permalink
Check nodes unique when identity change
Browse files Browse the repository at this point in the history
  • Loading branch information
Insoleet committed Dec 2, 2015
1 parent 0c3f2c0 commit 3fb275a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/cutecoin/core/net/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ def handle_new_node(self, peer, pubkey):
@pyqtSlot()
def handle_identity_change(self):
node = self.sender()
self._check_nodes_unique()
if node in self._root_nodes:
self.root_nodes_changed.emit()
self.nodes_changed.emit()
Expand Down
8 changes: 5 additions & 3 deletions src/cutecoin/core/net/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ def last_change(self, val):
def state(self, new_state):
#logging.debug("{:} | Last state : {:} / new state : {:}".format(self.pubkey[:5],
# self.state, new_state))

if self._state != new_state:
if self.pubkey[:5] in ("6YfbK", "J78bP"):
pass
self.last_change = time.time()
self._state = new_state
self.changed.emit()
Expand Down Expand Up @@ -354,7 +357,6 @@ def refresh_informations(self):

try:
peering_data = yield from bma.network.Peering(conn_handler).get()
logging.debug(peering_data)
node_pubkey = peering_data["pubkey"]
node_currency = peering_data["currency"]
self.state = Node.ONLINE
Expand Down Expand Up @@ -431,9 +433,9 @@ def refresh_uid(self):
self.identity_changed.emit()
except ValueError as e:
if '404' in str(e):
logging.debug("UID not found")
logging.debug("UID not found : {0}".format(self.pubkey))
else:
logging.debug("error in uid reply")
logging.debug("error in uid reply : {0}".format(self.pubkey))
self.state = Node.OFFLINE
self.identity_changed.emit()
except (ClientError, gaierror, asyncio.TimeoutError, DisconnectedError) as e:
Expand Down

0 comments on commit 3fb275a

Please sign in to comment.