code: func ExtractWitnessCommitment(tx *btcutil.Tx) ([]byte, bool) {
  	// The witness commitment *must* be located within one of the coinbase
  	// transaction's outputs.
  	if !IsCoinBase(tx) {
  		return nil, false
  	}
  
  	msgTx := tx.MsgTx()
  	for i := len(msgTx.TxOut) - 1; i >= 0; i-- {
  		// The public key script that contains the witness commitment
  		// must shared a prefix with the WitnessMagicBytes, and be at
  		// least 38 bytes.
  		pkScript := msgTx.TxOut[i].PkScript
  		if len(pkScript) >= CoinbaseWitnessPkScriptLength &&
  			bytes.HasPrefix(pkScript, WitnessMagicBytes) {
  
  			// The witness commitment itself is a 32-byte hash
  			// directly after the WitnessMagicBytes. The remaining
  			// bytes beyond the 38th byte currently have no consensus
  			// meaning.
  			start := len(WitnessMagicBytes)
  			end := CoinbaseWitnessPkScriptLength
  			return msgTx.TxOut[i].PkScript[start:end], true
  		}
  	}
  
  	return nil, false
  }
docs: // ExtractWitnessCommitment attempts to locate, and return the witness
  // commitment for a block. The witness commitment is of the form:
  // SHA256(witness root || witness nonce). The function additionally returns a
  // boolean indicating if the witness root was located within any of the txOut's
  // in the passed transaction. The witness commitment is stored as the data push
  // for an OP_RETURN with special magic bytes to aide in location.