mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-27 04:26:07 +00:00
verify age of uncle's parent (#719)
why: parent must be older => check needed for bcFrontierToHomestead test cases UncleFromFrontierInHomestead and UnclePopulation
This commit is contained in:
parent
e7745a6456
commit
cad1b5a678
@ -19,7 +19,9 @@ template runTest*(suiteName: string, caseFolder: string, body: untyped) =
|
|||||||
disableParamFiltering()
|
disableParamFiltering()
|
||||||
suite suiteName:
|
suite suiteName:
|
||||||
var status = initOrderedTable[string, OrderedTable[string, Status]]()
|
var status = initOrderedTable[string, OrderedTable[string, Status]]()
|
||||||
for fileName {.inject.} in walkDirRec(caseFolder):
|
for fileName {.inject.} in walkDirRec(
|
||||||
|
caseFolder, yieldFilter = {pcFile,pcLinkToFile}):
|
||||||
|
|
||||||
if not fileName.endsWith(".json"):
|
if not fileName.endsWith(".json"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -249,6 +249,13 @@ proc validateUncles(chainDB: BaseChainDB; header: BlockHeader;
|
|||||||
(uncle.parentHash == header.parentHash):
|
(uncle.parentHash == header.parentHash):
|
||||||
return err("Uncle's parent is not an ancestor")
|
return err("Uncle's parent is not an ancestor")
|
||||||
|
|
||||||
|
# check uncle against own parent
|
||||||
|
var parent: BlockHeader
|
||||||
|
if not chainDB.getBlockHeader(uncle.parentHash,parent):
|
||||||
|
return err("Uncle's parent has gone missing")
|
||||||
|
if uncle.timestamp <= parent.timestamp:
|
||||||
|
return err("Uncle's parent must me older")
|
||||||
|
|
||||||
# Now perform VM level validation of the uncle
|
# Now perform VM level validation of the uncle
|
||||||
if checkSealOK:
|
if checkSealOK:
|
||||||
result = hashCache.validateSeal(uncle)
|
result = hashCache.validateSeal(uncle)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user