ethereum-optimism / op-geth

GNU Lesser General Public License v3.0
281 stars 735 forks source link

beacon: Fix OP Legacy block hash checks #228

Closed trianglesphere closed 8 months ago

trianglesphere commented 8 months ago

Description

This fixes the OP Legacy Consensus engine VerifyHeaders function. When VerifyHeaders is called, only the first block is stored in the database & the reset are passed in as a slice. We previously called VerifyHeader from VerifyHeaders which would expect that the block's parent was in the database. This modifies VerifyHeaders to check that the first block is in the database & then checks the blocks one by one through the slice.

Tests

I have tested this on op-goerli & op-mainnet.