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

Commit d117c8f

Browse files
vubvub
authored andcommitted
Fixed homestead diff adjustment change
1 parent 2dd06a1 commit d117c8f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ethereum/blocks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
def calc_difficulty(parent, timestamp):
4040
config = parent.config
4141
offset = parent.difficulty // config['BLOCK_DIFF_FACTOR']
42-
if parent.number < config['HOMESTEAD_FORK_BLKNUM']:
43-
sign = 1 if timestamp - parent.timestamp < config['DIFF_ADJUSTMENT_CUTOFF'] else -1
44-
else:
42+
if parent.number >= (config['HOMESTEAD_FORK_BLKNUM'] - 1):
4543
sign = max(1 - 2 * ((timestamp - parent.timestamp) // config['HOMESTEAD_DIFF_ADJUSTMENT_CUTOFF']), -99)
44+
else:
45+
sign = 1 if timestamp - parent.timestamp < config['DIFF_ADJUSTMENT_CUTOFF'] else -1
4646
# If we enter a special mode where the genesis difficulty starts off below
4747
# the minimal difficulty, we allow low-difficulty blocks (this will never
4848
# happen in the official protocol)

0 commit comments

Comments
 (0)