Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
Smoother handling of underflow error in eth1_monitor
Browse files Browse the repository at this point in the history
No need to raise a `ValueError`, just break and allow the `Eth1BlockNotFound` to be raised below.

Co-authored-by: Hsiao-Wei Wang <hwwang156@gmail.com>
  • Loading branch information
carver and hwwhww committed May 18, 2020
1 parent 858452f commit da215a2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions trinity/components/eth2/eth1_monitor/eth1_monitor.py
Expand Up @@ -374,9 +374,7 @@ def _get_closest_eth1_voting_period_start_block(
for i in range(1, self._num_blocks_confirmed + 1):
lookback_number = block_number - i
if lookback_number < 0:
raise ValueError(
f"These shifted block numbers must be >=0, got {lookback_number}"
)
break
else:
shifted_block = BlockNumber(lookback_number)
block = self._eth1_data_provider.get_block(shifted_block)
Expand Down

0 comments on commit da215a2

Please sign in to comment.