|
@ -108,6 +108,12 @@ func (b *Block) Hash() cmn.HexBytes { |
|
|
// MakePartSet returns a PartSet containing parts of a serialized block.
|
|
|
// MakePartSet returns a PartSet containing parts of a serialized block.
|
|
|
// This is the form in which the block is gossipped to peers.
|
|
|
// This is the form in which the block is gossipped to peers.
|
|
|
func (b *Block) MakePartSet(partSize int) *PartSet { |
|
|
func (b *Block) MakePartSet(partSize int) *PartSet { |
|
|
|
|
|
if b == nil { |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
b.mtx.Lock() |
|
|
|
|
|
defer b.mtx.Unlock() |
|
|
|
|
|
|
|
|
// We prefix the byte length, so that unmarshaling
|
|
|
// We prefix the byte length, so that unmarshaling
|
|
|
// can easily happen via a reader.
|
|
|
// can easily happen via a reader.
|
|
|
bz, err := cdc.MarshalBinary(b) |
|
|
bz, err := cdc.MarshalBinary(b) |
|
|