post rebase fixes for BlockID, partSize

This commit is contained in:
Ethan Buchman
2016-11-16 16:13:17 -05:00
parent 4360c360a4
commit 07597dfd45
8 changed files with 46 additions and 32 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ type Block struct {
}
func MakeBlock(height int, chainID string, txs []Tx, commit *Commit,
prevBlockID BlockID, valHash, appHash []byte) (*Block, *PartSet) {
prevBlockID BlockID, valHash, appHash []byte, partSize int) (*Block, *PartSet) {
block := &Block{
Header: &Header{
ChainID: chainID,
@@ -39,7 +39,7 @@ func MakeBlock(height int, chainID string, txs []Tx, commit *Commit,
},
}
block.FillHeader()
return block, block.MakePartSet()
return block, block.MakePartSet(partSize)
}
// Basic validation that doesn't involve state data.
+9 -3
View File
@@ -12,17 +12,23 @@ type tm2pb struct{}
func (tm2pb) Header(header *Header) *types.Header {
return &types.Header{
ChainId: header.ChainID,
Height: uint64(header.Height),
Height: int32(header.Height),
Time: uint64(header.Time.Unix()),
NumTxs: uint64(header.NumTxs),
LastBlockHash: header.LastBlockHash,
LastBlockParts: TM2PB.PartSetHeader(header.LastBlockParts),
LastBlockId: TM2PB.BlockID(header.LastBlockID),
LastCommitHash: header.LastCommitHash,
DataHash: header.DataHash,
AppHash: header.AppHash,
}
}
func (tm2pb) BlockID(blockID BlockID) *types.BlockID {
return &types.BlockID{
Hash: blockID.Hash,
Parts: TM2PB.PartSetHeader(blockID.PartsHeader),
}
}
func (tm2pb) PartSetHeader(partSetHeader PartSetHeader) *types.PartSetHeader {
return &types.PartSetHeader{
Total: uint64(partSetHeader.Total),