Browse Source

types: lock block on MakePartSet

pull/1432/head
Ethan Buchman 7 years ago
parent
commit
bb1b249e8a
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      types/block.go

+ 6
- 0
types/block.go View File

@ -108,6 +108,12 @@ func (b *Block) Hash() cmn.HexBytes {
// MakePartSet returns a PartSet containing parts of a serialized block.
// This is the form in which the block is gossipped to peers.
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
// can easily happen via a reader.
bz, err := cdc.MarshalBinary(b)


Loading…
Cancel
Save