code: func shallowCopyTx(tx *wire.MsgTx) wire.MsgTx {
  	// As an additional memory optimization, use contiguous backing arrays
  	// for the copied inputs and outputs and point the final slice of
  	// pointers into the contiguous arrays.  This avoids a lot of small
  	// allocations.
  	txCopy := wire.MsgTx{
  		Version:  tx.Version,
  		TxIn:     make([]*wire.TxIn, len(tx.TxIn)),
  		TxOut:    make([]*wire.TxOut, len(tx.TxOut)),
  		LockTime: tx.LockTime,
  	}
  	txIns := make([]wire.TxIn, len(tx.TxIn))
  	for i, oldTxIn := range tx.TxIn {
  		txIns[i] = *oldTxIn
  		txCopy.TxIn[i] = &txIns[i]
  	}
  	txOuts := make([]wire.TxOut, len(tx.TxOut))
  	for i, oldTxOut := range tx.TxOut {
  		txOuts[i] = *oldTxOut
  		txCopy.TxOut[i] = &txOuts[i]
  	}
  	return txCopy
  }
docs: // shallowCopyTx creates a shallow copy of the transaction for use when
  // calculating the signature hash.  It is used over the Copy method on the
  // transaction itself since that is a deep copy and therefore does more work and
  // allocates much more space than needed.