view main.py @ 11:4987a219a704

add tests
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Tue, 26 Oct 2021 08:57:11 +0200
parents e218f70e19e9
children
line wrap: on
line source

import os
from puppy.block import deserialize_block


def main():
    filename = '/Users/dennis/Bitcoin/blocks/blk00000.dat'
    file_size = os.path.getsize(filename)
    print('File size in bytes: {}'. format(file_size))

    with open(filename, 'rb') as f:

        counter = 0
        while f.tell() < file_size:
            counter += 1
            block = deserialize_block(f)
            if counter == 3456:
                print(block)
                exit()


if __name__ == '__main__':
    main()