Skip to content

Commit 8a29fb1

Browse files
committed
dbft: fix prague fork bug
1 parent abbc333 commit 8a29fb1

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

consensus/dbft/dbft.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,17 @@ func (c *DBFT) verifyHeader(chain consensus.ChainHeaderReader, header *types.Hea
17941794
if !cancun && header.ParentBeaconRoot != nil {
17951795
return fmt.Errorf("invalid parentBeaconRoot, have %x, expected nil", header.ParentBeaconRoot)
17961796
}
1797+
1798+
prague := chain.Config().IsPrague(header.Number, header.Time)
1799+
if !prague {
1800+
if header.RequestsHash != nil {
1801+
return fmt.Errorf("invalid RequestsHash, have %#x, expected nil", header.RequestsHash)
1802+
}
1803+
} else {
1804+
if header.RequestsHash == nil {
1805+
return errors.New("header has nil RequestsHash after Prague")
1806+
}
1807+
}
17971808
// All basic checks passed, verify cascading fields
17981809
return c.verifyCascadingFields(chain, header, parents, isSealed)
17991810
}

miner/worker.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,10 @@ func (w *worker) prepareWork(genParams *generateParams, witness bool) (*environm
846846
header.BlobGasUsed = new(uint64)
847847
header.ExcessBlobGas = &excessBlobGas
848848
header.ParentBeaconRoot = genParams.beaconRoot
849+
850+
if w.chainConfig.IsPrague(header.Number, header.Time) {
851+
header.RequestsHash = &types.EmptyRequestsHash
852+
}
849853
}
850854
// Could potentially happen if starting to mine in an odd state.
851855
// Note genParams.coinbase can be different with header.Coinbase

0 commit comments

Comments
 (0)