txscript: reduce allocs in calcSignatureHash
This commit is contained in:
parent
187355448a
commit
b134beb3b7
1 changed files with 3 additions and 3 deletions
|
@ -355,9 +355,9 @@ func calcSignatureHash(script []parsedOpcode, hashType SigHashType, tx *wire.Msg
|
|||
// The final hash is the double sha256 of both the serialized modified
|
||||
// transaction and the hash type (encoded as a 4-byte little-endian
|
||||
// value) appended.
|
||||
var wbuf bytes.Buffer
|
||||
txCopy.Serialize(&wbuf)
|
||||
binary.Write(&wbuf, binary.LittleEndian, hashType)
|
||||
wbuf := bytes.NewBuffer(make([]byte, 0, txCopy.SerializeSize()+4))
|
||||
txCopy.Serialize(wbuf)
|
||||
binary.Write(wbuf, binary.LittleEndian, hashType)
|
||||
return chainhash.DoubleHashB(wbuf.Bytes())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue