blockchain-parser
blockchain-parser copied to clipboard
maximum recursion depth exceeded
File "blockchain-parser.py", line 30, in merkle_root return merkle_root([hash_pair(x,y) for x, y in zip(*[iter(lst)]*2)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Previous line repeated 996 more times] RecursionError: maximum recursion depth exceeded while calling a Python object
using python 3.11.3
sys.setrecursionlimit(num) crashes windows before completing a block transformation
Same problem, solved by modifying recursive function merkle_root
to while-loop
def merkle_root(lst):
sha256d = lambda x: hashlib.sha256(hashlib.sha256(x).digest()).digest()
hash_pair = lambda x, y: sha256d(x[::-1] + y[::-1])[::-1]
while len(lst) != 1:
if len(lst) % 2 == 1:
lst.append(lst[-1])
lst = [hash_pair(x,y) for x, y in zip(*[iter(lst)]*2)]
return lst[0]
Now it is a dead loop...
I think it is because the dat fil corrupted or you trying to parse any altcoin without some tricks