Wireless sensor networks face many challenges, the major one being energy. Batteries are the main source of energy for the sensor nodes. When the battery is depleted, it must either be charged or replaced. This may be expensive or impossible to do. Energy harvesting has been proposed as an alternative. The energy is harvested and then stored in a battery. However, even if the battery is not in use, it experiences current leakages. We study the performance of a single node, which has data packets and energy tokens. The energy that is harvested is kept in reserve as energy tokens in an energy buffer and utilised by the data packets for transmission. This paper investigates the impact of imposing a threshold on the token buffer of the system. The problem considered is managing the energy buffer by taking into account storage of energy, usage by the data packets and energy leakage. The proposed model considers the transmission of high and low priority data packets. To ensure that there are tokens available in the system to transmit the high-priority data packets in case the arrival rate of the low-priority data packets is too high at the expense of high priority data packets, a threshold is imposed on the token buffer. To illustrate our approach, a Geo/Geo/1/k system is modelled and finite Markov chain model tools are used to analyse it. Numerical examples, which show how performance measures such as the mean number of data packets and tokens in the system are affected by energy harvesting, leakage and threshold, are presented. From the results obtained we show that the model can be utilised in the analysis and control of a wireless sensor network, as it captures the usage and leakage of energy. A trade-off between threshold and rate of leakage exists.