txscript: Remove unneeded signature hash copies

These copies were likely left over from when MsgTx had no deep copy
functionality.
This commit is contained in:
Jonathan Gillham 2015-07-28 11:31:43 +01:00
parent 51fca61707
commit f8167ab36f

View file

@ -300,9 +300,6 @@ func calcSignatureHash(script []parsedOpcode, hashType SigHashType, tx *wire.Msg
// inputs that are not currently being processed.
txCopy := tx.Copy()
for i := range txCopy.TxIn {
var txIn wire.TxIn
txIn = *txCopy.TxIn[i]
txCopy.TxIn[i] = &txIn
if i == idx {
// UnparseScript cannot fail here because removeOpcode
// above only returns a valid script.
@ -313,13 +310,6 @@ func calcSignatureHash(script []parsedOpcode, hashType SigHashType, tx *wire.Msg
}
}
// Default behavior has all outputs set up.
for i := range txCopy.TxOut {
var txOut wire.TxOut
txOut = *txCopy.TxOut[i]
txCopy.TxOut[i] = &txOut
}
switch hashType & sigHashMask {
case SigHashNone:
txCopy.TxOut = txCopy.TxOut[0:0] // Empty slice.