public ITransfersSubscription addSubscription(AccountSubscription subscription) { if (subscription.keys.viewSecretKey != m_viewSecret) { throw new System.Exception("TransfersConsumer: view secret key mismatch"); } auto res = m_subscriptions[subscription.keys.address.spendPublicKey]; if (res.get() == null) { res.reset(new TransfersSubscription(m_currency, m_logger.GetLogger(), subscription)); m_spendKeys.Add(subscription.keys.address.spendPublicKey); if (m_subscriptions.Count == 1) { m_syncStart = res.getSyncStart(); } else { var subStart = res.getSyncStart(); m_syncStart.height = Math.Min(m_syncStart.height, subStart.height); m_syncStart.timestamp = Math.Min(m_syncStart.timestamp, subStart.timestamp); } } return(*res); }