reliability updates
This commit is contained in:
		| @@ -40,22 +40,30 @@ try: | ||||
|   exchrate=float(json.loads(fetch("https://api.coinbase.com/v2/exchange-rates?currency=BTC"))["data"]["rates"][currency]) | ||||
|   data=json.loads(fetch("http://www.zpool.ca/api/status")) | ||||
| except: | ||||
|   print("unable to retrieve remote data", file=sys.stderr) | ||||
|   sys.exit(-1) | ||||
|   if (len(sys.argv)!=5): | ||||
|     print("unable to retrieve remote data", file=sys.stderr) | ||||
|     sys.exit(-1) | ||||
|   else: | ||||
|     pass | ||||
|  | ||||
| # update algo map | ||||
|  | ||||
| changed=False | ||||
| for i in data: | ||||
|   try: | ||||
|     k=algo_map[i] | ||||
|   except: | ||||
|     algo_map[i]="" | ||||
|     changed=True | ||||
| try: | ||||
|   changed=False | ||||
|   for i in data: | ||||
|     try: | ||||
|       k=algo_map[i] | ||||
|     except: | ||||
|       algo_map[i]="" | ||||
|       changed=True | ||||
|  | ||||
|   if (changed==True):     | ||||
|     with open(sys.argv[3], "w") as outfile: | ||||
|       json.dump(algo_map, outfile, sort_keys=True, indent=2) | ||||
| except: | ||||
|   print("null response from server", file=sys.stderr) | ||||
|   sys.exit(-1) | ||||
|    | ||||
| if (changed==True):     | ||||
|   with open(sys.argv[3], "w") as outfile: | ||||
|     json.dump(algo_map, outfile, sort_keys=True, indent=2) | ||||
|  | ||||
| # weed out miners not supported by the pool | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user