File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ def proof_of_work(difficulty: int) -> int:
6
6
"""
7
7
Simulates a Proof of Work mining process.
8
8
9
- The miner must find a nonce such that the hash of the nonce starts
9
+ The miner must find a nonce such that the hash of the nonce starts
10
10
with a specific number of leading zeros (difficulty).
11
11
12
12
Args:
@@ -20,14 +20,14 @@ def proof_of_work(difficulty: int) -> int:
20
20
>>> isinstance(result, int)
21
21
True
22
22
"""
23
- prefix = "0" * difficulty
23
+ prefix = '0' * difficulty
24
24
nonce = 0
25
25
start = time .time ()
26
26
27
27
while True :
28
28
hash_result = hashlib .sha256 (f"{ nonce } " .encode ()).hexdigest ()
29
29
if hash_result .startswith (prefix ):
30
30
end = time .time ()
31
- print ( f"Nonce: { nonce } , Hash: { hash_result } , Time: { end - start :.2f } s" )
31
+ # Removed the print statement
32
32
return nonce
33
33
nonce += 1
You can’t perform that action at this time.
0 commit comments