Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 0d1fe01

Browse files
committed
Import exceptions directly
get rid of wildcard import and indirection
1 parent a98b360 commit 0d1fe01

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ethereum/chain.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from rlp.utils import encode_hex
1010
from ethereum import blocks
1111
from ethereum import processblock
12+
from ethereum.exceptions import VerificationFailed, InvalidTransaction
1213
from ethereum.slogging import get_logger
1314
from ethereum.config import Env
1415
import sys
@@ -301,7 +302,7 @@ def add_block(self, block, forward_pending_transactions=True):
301302
if block.has_parent():
302303
try:
303304
processblock.verify(block, block.get_parent())
304-
except processblock.VerificationFailed as e:
305+
except VerificationFailed as e:
305306
_log.critical('VERIFICATION FAILED', error=e)
306307
f = os.path.join(utils.data_dir, 'badblock.log')
307308
open(f, 'w').write(to_string(block.hex_serialize()))
@@ -351,7 +352,7 @@ def add_transaction(self, transaction):
351352
head_candidate.state_root = self.pre_finalize_state_root
352353
try:
353354
success, output = processblock.apply_transaction(head_candidate, transaction)
354-
except processblock.InvalidTransaction as e:
355+
except InvalidTransaction as e:
355356
# if unsuccessful the prerequisites were not fullfilled
356357
# and the tx is invalid, state must not have changed
357358
log.debug('invalid tx', error=e)

ethereum/processblock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from ethereum import specials
88
from ethereum import bloom
99
from ethereum import vm as vm
10-
from ethereum.exceptions import *
10+
from ethereum.exceptions import InvalidNonce, InsufficientStartGas, UnsignedTransaction, \
11+
BlockGasLimitReached, InsufficientBalance
1112
from ethereum.utils import safe_ord, normalize_address, mk_contract_address
1213
from ethereum import transactions
1314
import ethereum.config as config

0 commit comments

Comments
 (0)