diff --git a/types/block.go b/types/block.go index 94c78ecbc..57d12bbbc 100644 --- a/types/block.go +++ b/types/block.go @@ -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. diff --git a/types/test_util.go b/types/test_util.go index 0481c1388..367fd0631 100644 --- a/types/test_util.go +++ b/types/test_util.go @@ -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 -}