Mercurial > public > bitcaviar-plus
diff main.py @ 6:5f6d1a28051a
add python package config files
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 24 Oct 2021 15:18:54 +0200 |
parents | 1a8d94b500d8 |
children | e4afde8d5a7e |
line wrap: on
line diff
--- a/main.py Thu Oct 21 18:52:54 2021 +0200 +++ b/main.py Sun Oct 24 15:18:54 2021 +0200 @@ -1,13 +1,15 @@ -import json -from src.block import read_block +import os +from src.puppy.block import read_block def main(): - with open('/Users/dennis/Bitcoin/blocks/blk00000.dat', 'rb') as f: - for i in range(1): + file_path = '/Users/dennis/Bitcoin/blocks/blk00000.dat' + + with open(file_path, 'rb') as f: + number_of_bytes_in_file = os.path.getsize(file_path) + + while f.tell() < number_of_bytes_in_file: block = read_block(f) - with open('test_block_0.json', 'w') as f_test: - json.dump(block, f_test, ensure_ascii=False, indent=4) if __name__ == '__main__':