Husnain commited on
Commit
705c347
1 Parent(s): 07cc15a

♻️ [Refactor] Removed ID blocking system

Browse files
Files changed (1) hide show
  1. networks/proof_worker.py +6 -10
networks/proof_worker.py CHANGED
@@ -9,10 +9,7 @@ from constants.headers import OPENAI_GET_HEADERS
9
 
10
 
11
  class ProofWorker:
12
- def __init__(self, difficulty=None, required=False, seed=None):
13
- self.difficulty = difficulty
14
- self.required = required
15
- self.seed = seed
16
  self.proof_token_prefix = "gAAAAABwQ8Lk5FbGpA2NcR9dShT6gYjU7VxZ4D"
17
 
18
  def get_parse_time(self):
@@ -47,15 +44,14 @@ class ProofWorker:
47
  hash = hasher.digest().hex()
48
  if hash[:diff_len] <= difficulty:
49
  return "gAAAAAB" + base
50
- self.proof_token = (
51
- self.proof_token_prefix + base64.b64encode(seed.encode()).decode()
52
- )
53
- return self.proof_token
54
 
55
 
56
  if __name__ == "__main__":
57
  seed, difficulty = "0.42665582693491433", "05cdf2"
58
  worker = ProofWorker()
59
  proof_token = worker.calc_proof_token(seed, difficulty)
60
- print(f"proof_token: {proof_token}")
61
- # python -m networks.proof_worker
 
 
 
9
 
10
 
11
  class ProofWorker:
12
+ def __init__(self):
 
 
 
13
  self.proof_token_prefix = "gAAAAABwQ8Lk5FbGpA2NcR9dShT6gYjU7VxZ4D"
14
 
15
  def get_parse_time(self):
 
44
  hash = hasher.digest().hex()
45
  if hash[:diff_len] <= difficulty:
46
  return "gAAAAAB" + base
47
+ return None # Returning None if proof token calculation fails
 
 
 
48
 
49
 
50
  if __name__ == "__main__":
51
  seed, difficulty = "0.42665582693491433", "05cdf2"
52
  worker = ProofWorker()
53
  proof_token = worker.calc_proof_token(seed, difficulty)
54
+ if proof_token:
55
+ print(f"proof_token: {proof_token}")
56
+ else:
57
+ print("Failed to generate proof token.")