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.
|
// Serialize the MsgBlock.
|
||||||
var w bytes.Buffer
|
w := bytes.NewBuffer(make([]byte, 0, b.msgBlock.SerializeSize()))
|
||||||
err := b.msgBlock.Serialize(&w)
|
err := b.msgBlock.Serialize(w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue