From d3aadefb1fc234c06f0872967307847dfdd3b93c Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Wed, 4 May 2022 14:25:13 -0500 Subject: [PATCH] use a second variable to clarify the number of bytes used by an empty block --- types/block.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/block.go b/types/block.go index caabd0b1ef..6143130f11 100644 --- a/types/block.go +++ b/types/block.go @@ -41,9 +41,13 @@ const ( // 2 fields (2 embedded): 2 bytes // Uvarint length of Data.Txs: 4 bytes // Data fields: 6 bytes + MaxOverheadForBlock int64 = 16 + + // MinimumDataBytes is the numbers of bytes that will be taken up by empty + // block data // Hash in Data 32 bytes // OriginalSquareSize in Data 8 bytes - MaxOverheadForBlock int64 = 56 + MinimumDataBytes int64 = 40 ) // Block defines the atomic unit of a Tendermint blockchain. @@ -265,6 +269,7 @@ func BlockFromProto(bp *tmproto.Block) (*Block, error) { func MaxDataBytes(maxBytes, evidenceBytes int64, valsCount int) int64 { maxDataBytes := maxBytes - MaxOverheadForBlock - + MinimumDataBytes - MaxHeaderBytes - MaxCommitBytes(valsCount) - evidenceBytes @@ -288,6 +293,7 @@ func MaxDataBytes(maxBytes, evidenceBytes int64, valsCount int) int64 { func MaxDataBytesNoEvidence(maxBytes int64, valsCount int) int64 { maxDataBytes := maxBytes - MaxOverheadForBlock - + MinimumDataBytes - MaxHeaderBytes - MaxCommitBytes(valsCount)