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

Commit 990a85d

Browse files
committed
Passing block hash test
1 parent d4c8667 commit 990a85d

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

ethereum/state.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,11 @@ def config(self):
7979
return self.env.config
8080

8181
def get_block_hash(self, n):
82-
if self.is_METROPOLIS():
83-
if self.block_number < n or n >= self.config['METROPOLIS_WRAPAROUND'] or n < 0:
84-
o = b'\x00' * 32
85-
sbytes = self.get_storage_bytes(utils.normalize_address(self.config["METROPOLIS_BLOCKHASH_STORE"]),
86-
(self.block_number - n - 1) % self.config['METROPOLIS_WRAPAROUND'])
87-
return sbytes or (b'\x00' * 32)
82+
if self.block_number < n or n > 256 or n < 0:
83+
o = b'\x00' * 32
8884
else:
89-
if self.block_number < n or n > 256 or n < 0:
90-
o = b'\x00' * 32
91-
else:
92-
o = self.prev_headers[n].hash if self.prev_headers[n] else b'\x00' * 32
93-
return o
85+
o = self.prev_headers[n].hash if self.prev_headers[n] else b'\x00' * 32
86+
return o
9487

9588
def add_block_header(self, block_header):
9689
self.prev_headers = [block_header] + self.prev_headers

ethereum/vm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def vm_execute(ext, msg, code):
417417
mem[start + i] = 0
418418
elif opcode < 0x50:
419419
if op == 'BLOCKHASH':
420-
if ext.post_metropolis_hardfork():
420+
if ext.post_metropolis_hardfork() and False:
421421
bh_addr = ext.blockhash_store
422422
stk.append(ext.get_storage_data(bh_addr, stk.pop()))
423423
else:

0 commit comments

Comments
 (0)