miner: cap configured MaxBlobsPerBlock to protocol limit

Previously the user-configured MaxBlobsPerBlock replaced the protocol
limit unconditionally, allowing the miner to build blocks exceeding the
consensus maximum. Only apply the configured value when it is below the
protocol-defined cap.
This commit is contained in:
Weixie Cui 2026-07-04 15:08:39 +08:00
parent e3b6d0c86f
commit 63add3db8b

View file

@ -51,8 +51,8 @@ var (
// Users can specify the maximum number of blobs per block if necessary.
func (miner *Miner) maxBlobsPerBlock(time uint64) int {
maxBlobs := eip4844.MaxBlobsPerBlock(miner.chainConfig, time)
if miner.config.MaxBlobsPerBlock != 0 {
maxBlobs = miner.config.MaxBlobsPerBlock
if configured := miner.config.MaxBlobsPerBlock; configured != 0 && configured < maxBlobs {
maxBlobs = configured
}
return maxBlobs
}