Skip to content
Snippets Groups Projects
Commit 1112d9d6 authored by inso's avatar inso
Browse files

Merge branch 'master' into dev

parents fa9eb441 b7d83f77
No related branches found
No related tags found
No related merge requests found
......@@ -113,6 +113,10 @@ class Network(Watcher):
'''
Get nodes which are in the ONLINE state.
'''
latest = self.latest_block
for n in self._nodes:
if n.state in (Node.ONLINE, Node.DESYNCED):
n.check_sync(latest)
return [n for n in self.nodes if n.state == Node.ONLINE]
@property
......@@ -216,7 +220,7 @@ class Network(Watcher):
self._must_crawl = True
while self.continue_crawling():
emit_change = False
nodes = self.crawling(interval=10)
nodes = self.crawling(interval=2)
new_inlines = [n.endpoint.inline() for n in nodes]
last_inlines = [n.endpoint.inline() for n in self.nodes]
......
......@@ -216,20 +216,18 @@ class Node(QObject):
@last_change.setter
def last_change(self, val):
logging.debug("{:} | Changed state : {:}".format(self.pubkey[:5],
val))
#logging.debug("{:} | Changed state : {:}".format(self.pubkey[:5],val))
self._last_change = val
@state.setter
def state(self, new_state):
logging.debug("{:} | Last state : {:} / new state : {:}".format(self.pubkey[:5],
self.state, new_state))
#logging.debug("{:} | Last state : {:} / new state : {:}".format(self.pubkey[:5],self.state, new_state))
if self._state != new_state:
self.last_change = time.time()
self._state = new_state
def check_sync(self, block):
logging.debug("Check sync")
#logging.debug("Check sync")
if self.block < block:
self.state = Node.DESYNCED
else:
......
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