----------------------------------------------------------------------------- MaxDataBytes returns the maximum size of block's data. XXX: Panics on negative result.
(maxBytes, evidenceBytes int64, valsCount int)
| 276 | // |
| 277 | // XXX: Panics on negative result. |
| 278 | func 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 |