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

Commit f1cf0fa

Browse files
vubvub
authored andcommitted
Added timestamp and number checks
1 parent f8dcc98 commit f1cf0fa

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

ethereum/blocks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,10 @@ def validate_uncles(self):
644644
parent = get_block(self.env, uncle.prevhash)
645645
if uncle.difficulty != calc_difficulty(parent, uncle.timestamp):
646646
return False
647+
if uncle.number != parent.number + 1:
648+
return False
649+
if uncle.timestamp < parent.timestamp:
650+
return False
647651
if not uncle.check_pow():
648652
return False
649653
if uncle.prevhash not in eligible_ancestor_hashes:

ethereum/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ def int_to_32bytearray(i):
105105
i >>= 8
106106
return o
107107

108+
sha3_count = [0]
108109

109110
def sha3(seed):
111+
sha3_count[0] += 1
110112
return sha3_256(to_string(seed))
111113
assert sha3('').encode('hex') == 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
112114

fixtures

Submodule fixtures updated 31 files

0 commit comments

Comments
 (0)