File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,30 @@ func LatestMaxBlobsPerBlock(cfg *params.ChainConfig) int {
200200 return bcfg .Max
201201}
202202
203+ // TargetBlobsPerBlock returns the target blobs per block for a block at the given timestamp.
204+ func TargetBlobsPerBlock (cfg * params.ChainConfig , time uint64 ) int {
205+ blobConfig := latestBlobConfig (cfg , time )
206+ if blobConfig == nil {
207+ return 0
208+ }
209+ return blobConfig .Target
210+ }
211+
212+ // TargetBlobGasPerBlock returns the target blob gas that can be spent in a block at the given timestamp.
213+ func TargetBlobGasPerBlock (cfg * params.ChainConfig , time uint64 ) uint64 {
214+ return uint64 (TargetBlobsPerBlock (cfg , time )) * params .BlobTxBlobGasPerBlob
215+ }
216+
217+ // LatestTargetBlobsPerBlock returns the latest target blobs per block defined by the
218+ // configuration, regardless of the currently active fork.
219+ func LatestTargetBlobsPerBlock (cfg * params.ChainConfig ) int {
220+ bcfg := latestBlobConfig (cfg , math .MaxUint64 )
221+ if bcfg == nil {
222+ return 0
223+ }
224+ return bcfg .Target
225+ }
226+
203227// fakeExponential approximates factor * e ** (numerator / denominator) using
204228// Taylor expansion.
205229func fakeExponential (factor , numerator , denominator * big.Int ) * big.Int {
You can’t perform that action at this time.
0 commit comments