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

Commit 1b8c349

Browse files
authored
Merge pull request #380 from ethereum/EIP100
EIP 100
2 parents 0bb54d4 + d012c5d commit 1b8c349

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ethereum/blocks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def __str__(self):
6363
def calc_difficulty(parent, timestamp):
6464
config = parent.config
6565
offset = parent.difficulty // config['BLOCK_DIFF_FACTOR']
66-
if parent.number >= (config['HOMESTEAD_FORK_BLKNUM'] - 1):
66+
if parent.number >= (config['METROPOLIS_FORK_BLKNUM'] - 1):
67+
sign = max(len(parent.uncles) - ((timestamp - parent.timestamp) // config['METROPOLIS_DIFF_ADJUSTMENT_CUTOFF']), -99)
68+
elif parent.number >= (config['HOMESTEAD_FORK_BLKNUM'] - 1):
6769
sign = max(1 - ((timestamp - parent.timestamp) // config['HOMESTEAD_DIFF_ADJUSTMENT_CUTOFF']), -99)
6870
else:
6971
sign = 1 if timestamp - parent.timestamp < config['DIFF_ADJUSTMENT_CUTOFF'] else -1

ethereum/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
METROPOLIS_BLOCKHASH_STORE=0x20,
5555
METROPOLIS_WRAPAROUND=65536,
5656
METROPOLIS_GETTER_CODE=decode_hex('6000355460205260206020f3'),
57+
METROPOLIS_DIFF_ADJUSTMENT_CUTOFF=9,
58+
# Metropolis fork
5759
)
5860
assert default_config['NEPHEW_REWARD'] == \
5961
default_config['BLOCK_REWARD'] // 32

0 commit comments

Comments
 (0)