Skip to content

Commit 2908e04

Browse files
committed
cleanup ValidationError confusion
1 parent 04f3dd4 commit 2908e04

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

p2p/chain.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
BLANK_ROOT_HASH, EMPTY_UNCLE_HASH, GENESIS_BLOCK_NUMBER, GENESIS_PARENT_HASH)
3030
from eth.chains import AsyncChain
3131
from eth.db.trie import make_trie_root_and_nodes
32-
from eth.exceptions import HeaderNotFound, ValidationError
32+
from eth.exceptions import (
33+
HeaderNotFound,
34+
ValidationError as EthValidationError,
35+
)
3336
from eth.rlp.headers import BlockHeader
3437
from eth.rlp.receipts import Receipt
3538
from eth.rlp.transactions import BaseTransaction, BaseTransactionFields
@@ -204,7 +207,7 @@ async def _sync(self, peer: HeaderRequestingPeer) -> None:
204207
self.logger.warn("Timeout waiting for header batch from %s, aborting sync", peer)
205208
await peer.disconnect(DisconnectReason.timeout)
206209
break
207-
except ValidationError as err:
210+
except ValueError as err:
208211
self.logger.warn(
209212
"Invalid header response sent by peer %s disconnecting: %s",
210213
peer, err,
@@ -226,7 +229,7 @@ async def _sync(self, peer: HeaderRequestingPeer) -> None:
226229
self.logger.debug("Got new header chain starting at #%d", first.block_number)
227230
try:
228231
await self.chain.coro_validate_chain(headers, self._seal_check_random_sample_rate)
229-
except ValidationError as e:
232+
except EthValidationError as e:
230233
self.logger.warn("Received invalid headers from %s, aborting sync: %s", peer, e)
231234
break
232235
try:

p2p/peer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
from eth.chains.mainnet import MAINNET_NETWORK_ID
5454
from eth.chains.ropsten import ROPSTEN_NETWORK_ID
5555
from eth.constants import GENESIS_BLOCK_NUMBER
56-
from eth.exceptions import ValidationError
56+
from eth.exceptions import ValidationError as EthValidationError
5757
from eth.rlp.headers import BlockHeader
5858
from eth.vm.base import BaseVM
5959
from eth.vm.forks import HomesteadVM
@@ -995,7 +995,7 @@ async def ensure_same_side_on_dao_fork(
995995

996996
try:
997997
vm_class.validate_header(header, parent, check_seal=True)
998-
except ValidationError as err:
998+
except EthValidationError as err:
999999
raise DAOForkCheckFailure("Peer failed DAO fork check validation: {}".format(err))
10001000

10011001
return msgs

0 commit comments

Comments
 (0)