wire: reduce allocs in BlockHash()
This commit is contained in:
parent
807d344fe9
commit
187355448a
1 changed files with 2 additions and 2 deletions
|
@ -53,8 +53,8 @@ func (h *BlockHeader) BlockHash() chainhash.Hash {
|
|||
// transactions. Ignore the error returns since there is no way the
|
||||
// encode could fail except being out of memory which would cause a
|
||||
// run-time panic.
|
||||
var buf bytes.Buffer
|
||||
_ = writeBlockHeader(&buf, 0, h)
|
||||
buf := bytes.NewBuffer(make([]byte, 0, MaxBlockHeaderPayload))
|
||||
_ = writeBlockHeader(buf, 0, h)
|
||||
|
||||
return chainhash.DoubleHashH(buf.Bytes())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue