Skip to content

Commit

Permalink
fixed hash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescoxon committed Nov 15, 2018
1 parent cb2ee7e commit 134fe1d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,19 @@ def on_message(self, message):

if 'work_type' in ws_data:
# handle setup message for work type
work_type = ws_data['work_type']
print_time("Found work_type -> {}".format(work_type))
try:
self.update_work_type(work_type)
self.write_message('{"status": "success"}')
except Exception as e:
print_time(e)
self.write_message('{"status": "error", "description": "%s"}' % e)
if ws_data['address'] == 'xrb_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est':
print("Blacklisted")
elif ws_data['address'] == 'xrb_16wbiubx1fa4kxdnkqmxjbwt5a8rhhzaerscu6z3boy9r1u6hj37heg6zxcz':
print("Blacklisted")
else:
work_type = ws_data['work_type']
print_time("Found work_type -> {}".format(work_type))
try:
self.update_work_type(work_type)
#self.write_message('{"status": "success"}')
except Exception as e:
print_time(e)
#self.write_message('{"status": "error", "description": "%s"}' % e)
else:
# handle work message
hash_hex = ws_data['hash'].upper()
Expand Down Expand Up @@ -357,7 +362,7 @@ def on_message(self, message):
wss_work.remove(self)

else:
raise Exception("Failed to validate work - {} for worker {}".format(validation, self))
raise Exception("Failed to validate work - {} for worker {}".format(valid, self))

except Exception as e:
# TODO probably a good place to give some kind of punishment e.g. 1 minute without getting work
Expand Down
2 changes: 1 addition & 1 deletion scripts/insert_new_api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
print("Generate new key")
full_wallet_seed = hex(random.SystemRandom().getrandbits(128))
api_key = full_wallet_seed[2:].upper()
api_key_hashed = hashlib.sha512(k.encode('utf-8')).hexdigest()
api_key_hashed = hashlib.sha512(api_key.encode('utf-8')).hexdigest()

print("%s %s %s" % (username, api_key, api_key_hashed))

Expand Down

0 comments on commit 134fe1d

Please sign in to comment.