Skip to content

Commit

Permalink
use a second variable to clarify the number of bytes used by an empty…
Browse files Browse the repository at this point in the history
… block
  • Loading branch information
evan-forbes committed May 4, 2022
1 parent e6cee7b commit d3aadef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit d3aadef

Please sign in to comment.