Reduce allocs in Block.Bytes()
This commit is contained in:
parent
9b9ce80a2e
commit
f6a0d000db
1 changed files with 2 additions and 2 deletions
4
block.go
4
block.go
|
@ -56,8 +56,8 @@ func (b *Block) Bytes() ([]byte, error) {
|
|||
}
|
||||
|
||||
// Serialize the MsgBlock.
|
||||
var w bytes.Buffer
|
||||
err := b.msgBlock.Serialize(&w)
|
||||
w := bytes.NewBuffer(make([]byte, 0, b.msgBlock.SerializeSize()))
|
||||
err := b.msgBlock.Serialize(w)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue