code: func calcHashOutputs(tx *wire.MsgTx) chainhash.Hash {
  	var b bytes.Buffer
  	for _, out := range tx.TxOut {
  		wire.WriteTxOut(&b, 0, 0, out)
  	}
  
  	return chainhash.DoubleHashH(b.Bytes())
  }
docs: // calcHashOutputs computes a hash digest of all outputs created by the
  // transaction encoded using the wire format. This single hash can be re-used
  // when validating all inputs spending witness programs, which include
  // signatures using the SigHashAll sighash type. This allows computation to be
  // cached, reducing the total hashing complexity from O(N^2) to O(N).