mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 09:50:08 +01:00
txscript: reduce allocs in calcSignatureHash
This commit is contained in:
parent
187355448a
commit
b134beb3b7
@ -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 New Issue
Block a user