Skip to content

Commit a9fe319

Browse files
committed
Fix wrong block hash value for the 1st EVM block with PrevRandao
1 parent 99c8faa commit a9fe319

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

storage/pebble/blocks.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,15 @@ func (b *Blocks) getBlock(keyCode byte, key []byte) (*models.Block, error) {
253253
}
254254

255255
if b.chainID == flowGo.Testnet && slices.Contains(testnetBrokenParentHashBlockHeights, block.Height) {
256+
// Since we are going to modify the `block.ParentBlockHash` field,
257+
// we need to set the `block.FixedHash` field. If we don't do so,
258+
// `block.Hash()` will return a different hash.
259+
blockHash, err := block.Hash()
260+
if err != nil {
261+
return nil, err
262+
}
263+
block.FixedHash = blockHash
264+
256265
parentBlock, err := b.getBlock(blockHeightKey, uint64Bytes(block.Height-1))
257266
if err != nil {
258267
return nil, err

0 commit comments

Comments
 (0)