Mercurial > public > bitcaviar-plus
comparison main.py @ 8:4d259e84160d
fix OverFlow bug
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 24 Oct 2021 17:38:23 +0200 |
parents | e4afde8d5a7e |
children | e218f70e19e9 |
comparison
equal
deleted
inserted
replaced
7:e4afde8d5a7e | 8:4d259e84160d |
---|---|
1 import os | |
2 from puppy.block import deserialize_block | |
3 | |
4 | |
1 def main(): | 5 def main(): |
2 file_path = '/Users/dennis/Bitcoin/blocks/blk00000.dat' | 6 filename = '/Users/dennis/Bitcoin/blocks/blk00000.dat' |
7 file_size = os.path.getsize(filename) | |
8 print('File size in bytes: {}'. format(file_size)) | |
3 | 9 |
4 with open(file_path, 'rb') as f: | 10 with open(filename, 'rb') as f: |
5 pass | 11 while f.tell() < file_size: |
12 block = deserialize_block(f) | |
6 | 13 |
7 | 14 |
8 if __name__ == '__main__': | 15 if __name__ == '__main__': |
9 main() | 16 main() |