mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 22:05:18 +00:00
types: move MakeBlock to block.go (#5573)
This commit is contained in:
@@ -305,6 +305,25 @@ func MaxDataBytesNoEvidence(maxBytes int64, valsCount int) int64 {
|
||||
return maxDataBytes
|
||||
}
|
||||
|
||||
// MakeBlock returns a new block with an empty header, except what can be
|
||||
// computed from itself.
|
||||
// It populates the same set of fields validated by ValidateBasic.
|
||||
func MakeBlock(height int64, txs []Tx, lastCommit *Commit, evidence []Evidence) *Block {
|
||||
block := &Block{
|
||||
Header: Header{
|
||||
Version: tmversion.Consensus{Block: version.BlockProtocol, App: 0},
|
||||
Height: height,
|
||||
},
|
||||
Data: Data{
|
||||
Txs: txs,
|
||||
},
|
||||
Evidence: EvidenceData{Evidence: evidence},
|
||||
LastCommit: lastCommit,
|
||||
}
|
||||
block.fillHeader()
|
||||
return block
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Header defines the structure of a Tendermint block header.
|
||||
|
||||
@@ -5,8 +5,6 @@ import (
|
||||
"time"
|
||||
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
tmversion "github.com/tendermint/tendermint/proto/tendermint/version"
|
||||
"github.com/tendermint/tendermint/version"
|
||||
)
|
||||
|
||||
func MakeCommit(blockID BlockID, height int64, round int32,
|
||||
@@ -80,22 +78,3 @@ func MakeVote(
|
||||
|
||||
return vote, nil
|
||||
}
|
||||
|
||||
// MakeBlock returns a new block with an empty header, except what can be
|
||||
// computed from itself.
|
||||
// It populates the same set of fields validated by ValidateBasic.
|
||||
func MakeBlock(height int64, txs []Tx, lastCommit *Commit, evidence []Evidence) *Block {
|
||||
block := &Block{
|
||||
Header: Header{
|
||||
Version: tmversion.Consensus{Block: version.BlockProtocol, App: 0},
|
||||
Height: height,
|
||||
},
|
||||
Data: Data{
|
||||
Txs: txs,
|
||||
},
|
||||
Evidence: EvidenceData{Evidence: evidence},
|
||||
LastCommit: lastCommit,
|
||||
}
|
||||
block.fillHeader()
|
||||
return block
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user