types: move MakeVote / MakeBlock functions (#3819)

to the types package

Paritally Fixes #3584
This commit is contained in:
Marko
2019-07-25 10:13:19 +02:00
committed by Anton Kaliaev
parent 98cb8c9783
commit 4b9e8505cb
6 changed files with 50 additions and 83 deletions

View File

@ -41,25 +41,6 @@ type Block struct {
LastCommit *Commit `json:"last_commit"`
}
// 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{
Height: height,
NumTxs: int64(len(txs)),
},
Data: Data{
Txs: txs,
},
Evidence: EvidenceData{Evidence: evidence},
LastCommit: lastCommit,
}
block.fillHeader()
return block
}
// ValidateBasic performs basic validation that doesn't involve state data.
// It checks the internal consistency of the block.
// Further validation is done using state#ValidateBlock.