-
Notifications
You must be signed in to change notification settings - Fork 2k
Catch assertion error in height_to_hash() #18667
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
base: main
Are you sure you want to change the base?
Conversation
height_hash: Optional[bytes32] = None | ||
try: | ||
height_hash = self.height_to_hash(peak_block.height) | ||
except Exception: |
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.
It seems risky to catch (and ignore) all exceptions. This would include assertion failures.
I think it would be more precise to either check if the current chain has the block height we're about to look up.
|
now that we've realized that |
This PR has been flagged as stale due to no activity for over 60 days. It will not be automatically closed, but it has been given a stale-pr label and should be manually reviewed by the relevant parties. |
Purpose:
Currently get_hash() in block_height_map.py has an assert which can fail and is not caught in the calling height_to_hash() function in blockchain.py.
In this case we should treat it as though we are on a fork that is further ahead than us.
This PR adds in try except condition, a default value, and a log for when this case is hit.
Current Behavior:
Raises the exception.
New Behavior:
Catches, logs and proceeds