Compare commits

...

8 Commits

@ -2,18 +2,13 @@
"xmr": {
"mainnet": {
"tor": [
"fdlnlt5mr5o7lmhg.onion:18081",
"xmkwypann4ly64gh.onion:18081",
"xmrtolujkxnlinre.onion:18081",
"xmrag4hf5xlabmob.onion:18081",
"monero26mmldsallmxok2kwamne4ve3mybvvn2yijsvss7ey63hc4yyd.onion:18081",
"nrw57zxw5zyevn3i.onion:18081",
"monero5sjoz5xmjn.onion:18081",
"mxcd4577fldb3ppzy7obmmhnu3tf57gbcbd4qhwr2kxyjj2qi3dnbfqd.onion:18081",
"moneroxmrxw44lku6qniyarpwgznpcwml4drq7vb24ppatlcg4kmxpqd.onion:18089",
"moneroptqodufzxj.onion:18081",
"3hvpnd4xejtzcuowvru2wfjum5wjf7synigm44rrizr3k4v5vzam2bad.onion:18081",
"6dsdenp6vjkvqzy4wzsnzn6wixkdzihx3khiumyzieauxuxslmcaeiad.onion:18081",
"3t7v5zpcfxq2tocdofdcwxgrldco3elotz3iis4jtbbnscy5alezw7yd.onion:18081"
],
"clearnet": [
@ -22,16 +17,11 @@
"usa-east-va.node.xmr.pm:18089",
"canada.node.xmr.pm:18089",
"singapore.node.xmr.pm:18089",
"192.110.160.146:18089",
"nodes.hashvault.pro:18081",
"node.supportxmr.com:18081",
"node.imonero.org:18081",
"xmr-node-eu.cakewallet.com:18081",
"xmr-node-usa-east.cakewallet.com:18081",
"node.xmr.pt:18081",
"node.xmr.ru:18081",
"xmr-peer-070.cypherpunklabs.com:18081",
"xmr.fail:18081"
"node.xmr.ru:18081"
]
},
"stagenet": {

@ -17,16 +17,16 @@ import settings
now = datetime.now()
app: Quart = None
cache = None
rpc_nodes: dict = None
user_agents: List[str] = None
connected_websockets: Set[asyncio.Queue] = set()
_is_primary_worker_thread = False
async def _setup_nodes(app: Quart):
global rpc_nodes
with open("data/nodes.json", "r") as f:
rpc_nodes = json.loads(f.read()).get(settings.COIN_SYMBOL)
global cache
with open('data/nodes.json', 'r') as f:
nodes = json.loads(f.read()).get(settings.COIN_SYMBOL)
cache.execute('JSON.SET', 'nodes', '.', json.dumps(nodes))
async def _setup_user_agents(app: Quart):

@ -123,6 +123,16 @@ class FeatherTask:
async def end(self, result: dict):
raise NotImplementedError()
async def cache_json_get(self, key: str, path="."):
from fapi.factory import app, cache
try:
data = await cache.execute('JSON.GET', key, path)
if data:
return json.loads(data)
except Exception as ex:
app.logger.error(f"Redis error: {ex}")
async def cache_get(self, key: str) -> dict:
from fapi.factory import app, cache

@ -24,13 +24,15 @@ class RPCNodeCheckTask(FeatherTask):
async def task(self) -> List[dict]:
"""Check RPC nodes status"""
from fapi.factory import app, rpc_nodes, cache
from fapi.factory import app, cache
try:
heights = json.loads(await cache.get("blockheights"))
except:
heights = {}
rpc_nodes = await self.cache_json_get("nodes")
nodes = []
for network_type_coin, _ in rpc_nodes.items():
data = []
@ -67,7 +69,7 @@ class RPCNodeCheckTask(FeatherTask):
# popularity contest
common_height = popularity_contest([z['height'] for z in data])
valid_heights = range(common_height, common_height - allowed_offset, -1)
valid_heights = range(common_height + allowed_offset, common_height - allowed_offset, -1)
data = list(map(lambda _node: _node if _node['height'] in valid_heights
else self._bad_node(**_node), data))

Loading…
Cancel
Save