From 5399bb6d00926b057dec869f02dbdb7abb7dd486 Mon Sep 17 00:00:00 2001 From: Inso <insomniak.fr@gmail.com> Date: Sun, 5 Jul 2015 18:47:04 +0200 Subject: [PATCH] Fix bug in network refresh + version in cache --- src/cutecoin/core/net/api/bma/__init__.py | 2 +- src/cutecoin/core/net/api/bma/access.py | 2 ++ src/cutecoin/core/net/network.py | 3 +-- src/cutecoin/gui/network_tab.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cutecoin/core/net/api/bma/__init__.py b/src/cutecoin/core/net/api/bma/__init__.py index 9fb8038d..1b6b94bc 100644 --- a/src/cutecoin/core/net/api/bma/__init__.py +++ b/src/cutecoin/core/net/api/bma/__init__.py @@ -126,4 +126,4 @@ class API(object): logging.debug(url.toString(QUrl.FullyEncoded)) return reply -from . import network, blockchain, tx, wot, ud \ No newline at end of file +from . import network, blockchain, tx, wot, ud, node \ No newline at end of file diff --git a/src/cutecoin/core/net/api/bma/access.py b/src/cutecoin/core/net/api/bma/access.py index 02125a74..0178cf92 100644 --- a/src/cutecoin/core/net/api/bma/access.py +++ b/src/cutecoin/core/net/api/bma/access.py @@ -2,6 +2,7 @@ from PyQt5.QtCore import QObject, pyqtSlot from PyQt5.QtNetwork import QNetworkReply from . import blockchain, ConnectionHandler from .....tools.exceptions import NoPeerAvailable +from ..... import __version__ import logging import json import asyncio @@ -161,6 +162,7 @@ class BmaAccess(QObject): self._data[cache_key]['value'] = {} self._data[cache_key]['metadata']['block'] = self._network.latest_block + self._data[cache_key]['metadata']['cutecoin_version'] = __version__ if not self._compare_json(self._data[cache_key]['value'], data): self._data[cache_key]['value'] = data return True diff --git a/src/cutecoin/core/net/network.py b/src/cutecoin/core/net/network.py index ccb4716e..26d1a4c9 100644 --- a/src/cutecoin/core/net/network.py +++ b/src/cutecoin/core/net/network.py @@ -186,9 +186,8 @@ class Network(QObject): node = self.nodes[index] return self._root_nodes.index(node) - @asyncio.coroutine def refresh_once(self): - for node in self.nodes: + for node in self._nodes: node.refresh() @asyncio.coroutine diff --git a/src/cutecoin/gui/network_tab.py b/src/cutecoin/gui/network_tab.py index f38eebbb..73349efb 100644 --- a/src/cutecoin/gui/network_tab.py +++ b/src/cutecoin/gui/network_tab.py @@ -96,6 +96,6 @@ class NetworkTabWidget(QWidget, Ui_NetworkTabWidget): QDesktopServices.openUrl(url) def manual_nodes_refresh(self): - asyncio.async(self.community.network.refresh_once()) + self.community.network.refresh_once() -- GitLab