blockchain-parser icon indicating copy to clipboard operation
blockchain-parser copied to clipboard

maximum recursion depth exceeded

Open ghost opened this issue 1 year ago • 1 comments

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

ghost avatar Apr 10 '23 13:04 ghost

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...

NewJerseyStyle avatar Jan 03 '24 06:01 NewJerseyStyle

I think it is because the dat fil corrupted or you trying to parse any altcoin without some tricks

ragestack avatar Apr 30 '24 04:04 ragestack