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
|
// transactions. Ignore the error returns since there is no way the
|
||||||
// encode could fail except being out of memory which would cause a
|
// encode could fail except being out of memory which would cause a
|
||||||
// run-time panic.
|
// run-time panic.
|
||||||
var buf bytes.Buffer
|
buf := bytes.NewBuffer(make([]byte, 0, MaxBlockHeaderPayload))
|
||||||
_ = writeBlockHeader(&buf, 0, h)
|
_ = writeBlockHeader(buf, 0, h)
|
||||||
|
|
||||||
return chainhash.DoubleHashH(buf.Bytes())
|
return chainhash.DoubleHashH(buf.Bytes())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue