-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Efficient pool info parsing #80
Conversation
dd22c85
to
d2a5a52
Compare
9a95c9e
to
6255b8c
Compare
6255b8c
to
90ba9f5
Compare
src/helpers/helper.py
Outdated
for info in coinbase_tags.values(): | ||
known_entities.add(info['name']) | ||
except FileNotFoundError: | ||
coinbase_tags = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? We could just use pass
if we don't want anything to happen in case of an exception
src/helpers/helper.py
Outdated
for cluster in clusters.keys(): | ||
known_entities.add(cluster) | ||
except FileNotFoundError: | ||
clusters = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as L78
src/helpers/helper.py
Outdated
for address_info in pool_addresses.values(): | ||
known_entities.add(address_info['name']) | ||
except FileNotFoundError: | ||
pool_addresses = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as L78 and L86
src/helpers/helper.py
Outdated
""" | ||
try: | ||
with open(HELPERS_DIR / f'pool_information/coinbase_tags/{project_name}.json') as f: | ||
pool_data = json.load(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not important but pool_tags
would be a more suitable name for this variable
@@ -44,8 +44,23 @@ def test_map(setup_and_cleanup): | |||
pool_info_dir, test_input_dir, test_output_dir = setup_and_cleanup | |||
project = 'sample_bitcoin' | |||
|
|||
shutil.copy2(str(pool_info_dir / 'bitcoin.json'), | |||
str(pool_info_dir / f'{project}.json')) # Create a temp pool info file for sample | |||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's good practice to use try-except blocks in tests, but I also don't mind leaving these for now as long as we update them when we refactor tests more broadly, e.g. for #53
@@ -17,45 +17,57 @@ coinbase addresses, so it doesn't perform any extra processing on the raw data. | |||
|
|||
## Pool Information | |||
|
|||
To assist the mapping process, the directory `helpers/pool_information/` contains files named `<project_name>.json`, with | |||
relevant pool information, structured as follows: | |||
To assist the mapping process, the directory `helpers/pool_information/` contains |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing sentence
docs/mappings.md
Outdated
There exist three subdirectories. In each subdirectory there exists a file for | ||
the corresponding ledger data, if such data exists. | ||
|
||
`coinbase_tags` defines information about pools and miners. Each key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say information about "block creators" as it is captures more systems. We can keep pools and miners as examples in brackets.
1e1c6fe
to
23813c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Depends on #79