MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / MaxDataBytes

Function MaxDataBytes

types/block.go:278–294  ·  view source on GitHub ↗

----------------------------------------------------------------------------- MaxDataBytes returns the maximum size of block's data. XXX: Panics on negative result.

(maxBytes, evidenceBytes int64, valsCount int)

Source from the content-addressed store, hash-verified

276//
277// XXX: Panics on negative result.
278func MaxDataBytes(maxBytes, evidenceBytes int64, valsCount int) int64 {
279 maxDataBytes := maxBytes -
280 MaxOverheadForBlock -
281 MaxHeaderBytes -
282 MaxCommitBytes(valsCount) -
283 evidenceBytes
284
285 if maxDataBytes < 0 {
286 panic(fmt.Sprintf(
287 "Negative MaxDataBytes. Block.MaxBytes=%d is too small to accommodate header&lastCommit&evidence=%d",
288 maxBytes,
289 -(maxDataBytes - maxBytes),
290 ))
291 }
292
293 return maxDataBytes
294}
295
296// MaxDataBytesNoEvidence returns the maximum size of block's data when
297// evidence count is unknown. MaxEvidencePerBlock will be used for the size

Callers 2

CreateProposalBlockMethod · 0.92
TestBlockMaxDataBytesFunction · 0.85

Calls 1

MaxCommitBytesFunction · 0.85

Tested by 1

TestBlockMaxDataBytesFunction · 0.68