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

Commit f78ff08

Browse files
vubvub
authored andcommitted
EIP 100
1 parent 8555a90 commit f78ff08

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
@@ -53,6 +53,8 @@
5353
METROPOLIS_BLOCKHASH_STORE=0x20,
5454
METROPOLIS_WRAPAROUND=65536,
5555
METROPOLIS_GETTER_CODE='6000355460205260206020f3'.decode('hex'),
56+
METROPOLIS_DIFF_ADJUSTMENT_CUTOFF=9,
57+
# Metropolis fork
5658
)
5759
assert default_config['NEPHEW_REWARD'] == \
5860
default_config['BLOCK_REWARD'] // 32

0 commit comments

Comments
 (0)