diff --git a/src/cutecoin/core/net/network.py b/src/cutecoin/core/net/network.py index b46be63026850979bcc5f11677a1c2f6341caa99..a4fbb5d1fff0f3a5e05999c3fa119a83e9c69e38 100644 --- a/src/cutecoin/core/net/network.py +++ b/src/cutecoin/core/net/network.py @@ -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] diff --git a/src/cutecoin/core/net/node.py b/src/cutecoin/core/net/node.py index 1f8186eb79f0597e845c9f025f50354eab734c76..ec0bd8bb5c0d16b716753769ca3bc8beb0a578bc 100644 --- a/src/cutecoin/core/net/node.py +++ b/src/cutecoin/core/net/node.py @@ -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: