comparison main.py @ 9:e218f70e19e9

refactor code
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Sun, 24 Oct 2021 21:00:49 +0200
parents 4d259e84160d
children
comparison
equal deleted inserted replaced
8:4d259e84160d 9:e218f70e19e9
6 filename = '/Users/dennis/Bitcoin/blocks/blk00000.dat' 6 filename = '/Users/dennis/Bitcoin/blocks/blk00000.dat'
7 file_size = os.path.getsize(filename) 7 file_size = os.path.getsize(filename)
8 print('File size in bytes: {}'. format(file_size)) 8 print('File size in bytes: {}'. format(file_size))
9 9
10 with open(filename, 'rb') as f: 10 with open(filename, 'rb') as f:
11
12 counter = 0
11 while f.tell() < file_size: 13 while f.tell() < file_size:
14 counter += 1
12 block = deserialize_block(f) 15 block = deserialize_block(f)
16 if counter == 3456:
17 print(block)
18 exit()
13 19
14 20
15 if __name__ == '__main__': 21 if __name__ == '__main__':
16 main() 22 main()