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

Commit dc5e96e

Browse files
committed
Delete pow.ethash and pow.ethash_utils
They were broken (lots of undefined names) and no longer used as pyethash is now listed in requirements.txt
1 parent 57a7d28 commit dc5e96e

File tree

5 files changed

+7
-264
lines changed

5 files changed

+7
-264
lines changed

ethereum/pow/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from ethereum.pow import chain, consensus, ethash, ethash_utils, ethpow
1+
from ethereum.pow import chain, consensus, ethpow

ethereum/pow/consensus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ethereum.pow import ethash, ethash_utils, ethpow
1+
from ethereum.pow import ethpow
22
from ethereum import utils
33
from ethereum.common import update_block_env_variables, calc_difficulty
44
from ethereum.exceptions import VerificationFailed

ethereum/pow/ethash.py

Lines changed: 0 additions & 100 deletions
This file was deleted.

ethereum/pow/ethash_utils.py

Lines changed: 0 additions & 136 deletions
This file was deleted.

ethereum/pow/ethpow.py

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
from ethereum.pow import ethash
21
from ethereum import utils
3-
import time
42
import sys
5-
import warnings
63
from collections import OrderedDict
7-
from ethereum import utils
84
from ethereum.slogging import get_logger
9-
import rlp
5+
import pyethash
106

117
log = get_logger('eth.pow')
128

@@ -15,24 +11,10 @@
1511
else:
1612
from functools import lru_cache
1713

18-
try:
19-
import pyethash
20-
ETHASH_LIB = 'pyethash' # the C++ based implementation
21-
except ImportError:
22-
ETHASH_LIB = 'ethash'
23-
warnings.warn('using pure python implementation', ImportWarning)
24-
25-
if ETHASH_LIB == 'ethash':
26-
mkcache = ethash.mkcache
27-
EPOCH_LENGTH = 30000
28-
hashimoto_light = ethash.hashimoto_light
29-
elif ETHASH_LIB == 'pyethash':
30-
mkcache = pyethash.mkcache_bytes
31-
EPOCH_LENGTH = 30000
32-
hashimoto_light = lambda s, c, h, n: \
33-
pyethash.hashimoto_light(s, c, h, utils.big_endian_to_int(n))
34-
else:
35-
raise Exception("invalid ethash library set")
14+
mkcache = pyethash.mkcache_bytes
15+
EPOCH_LENGTH = 30000
16+
def hashimoto_light(s, c, h, n):
17+
return pyethash.hashimoto_light(s, c, h, utils.big_endian_to_int(n))
3618

3719
TT64M1 = 2**64 - 1
3820
cache_seeds = ['\x00' * 32]
@@ -41,7 +23,6 @@
4123

4224

4325
def get_cache(block_number):
44-
import sha3
4526
while len(cache_seeds) <= block_number // EPOCH_LENGTH:
4627
cache_seeds.append(utils.sha3(cache_seeds[-1]))
4728
seed = cache_seeds[block_number // EPOCH_LENGTH]
@@ -124,5 +105,3 @@ def mine(block_number, difficulty, mining_hash, start_nonce=0, rounds=1000):
124105
assert len(o[b"mix digest"]) == 32
125106
return bin_nonce, o[b"mix digest"]
126107
return None, None
127-
128-

0 commit comments

Comments
 (0)