A generic formulation for the optimal control of a single reacting two-body point absorber type wave-energy converter (WEC) is proposed. The formulation involves hard and soft constraints on the motion of the WEC to promote reduced damage with the aim of increasing the service life of the device. Most of the WEC control literature ignores the cost of the control and could therefore result in extracting less energy than expected, or even negative energy. Therefore, to ensure actual energy gains in practice, we incorporate a penalty term in the objective function to approximate the cost of applying the control force. Based on our derivations, the cost of the control force can be approximated as a quadratic function of the input force. We also incorporate another cost term to ensure smoothness of the control force. A discretization of the resulting optimal control problem, maximizing the net energy extraction, is a quadratic optimization problem that can be solved efficiently using state-of-the-art solvers. Using hydrodynamic coefficients estimated by simulations made in WEC-Sim, numerical illustrations are provided of the trade-off between careful operation of the device and energy absorbed. Finally, a demonstration of the real-time use of the approach is provided.