Skip to content

Commit aa5c98d

Browse files
MariusVanDerWijdenkaralabe
authored andcommitted
eth/catalyst: return 0x0 if latestvalid is pow block (ethereum#25423)
* eth/catalyst: return 0x0 if latestvalid is pow block * eth/catalyst: return 0x0 if latestvalid is pow block * eth/catalyst: fix header retrieval, fix sign check Co-authored-by: Péter Szilágyi <[email protected]>
1 parent fef2896 commit aa5c98d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

eth/catalyst/api.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,15 @@ func (api *ConsensusAPI) checkInvalidAncestor(check common.Hash, head common.Has
479479
}
480480
api.invalidTipsets[head] = invalid
481481
}
482+
// If the last valid hash is the terminal pow block, return 0x0 for latest valid hash
483+
lastValid := &invalid.ParentHash
484+
if header := api.eth.BlockChain().GetHeader(invalid.ParentHash, invalid.Number.Uint64()-1); header != nil && header.Difficulty.Sign() != 0 {
485+
lastValid = &common.Hash{}
486+
}
482487
failure := "links to previously rejected block"
483488
return &beacon.PayloadStatusV1{
484489
Status: beacon.INVALID,
485-
LatestValidHash: &invalid.ParentHash,
490+
LatestValidHash: lastValid,
486491
ValidationError: &failure,
487492
}
488493
}

0 commit comments

Comments
 (0)