2016-01-18 15:33:29 +00:00
|
|
|
// Copyright (c) 2011-2016 The Cryptonote developers
|
2015-09-18 11:55:31 +00:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2015-04-06 16:13:07 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ITransfersSynchronizer.h"
|
|
|
|
#include "TransfersContainer.h"
|
|
|
|
#include "IObservableImpl.h"
|
|
|
|
|
|
|
|
namespace CryptoNote {
|
|
|
|
|
|
|
|
class TransfersSubscription : public IObservableImpl < ITransfersObserver, ITransfersSubscription > {
|
|
|
|
public:
|
2015-05-27 12:08:46 +00:00
|
|
|
TransfersSubscription(const CryptoNote::Currency& currency, const AccountSubscription& sub);
|
2015-04-06 16:13:07 +00:00
|
|
|
|
|
|
|
SynchronizationStart getSyncStart();
|
2015-07-30 15:22:07 +00:00
|
|
|
void onBlockchainDetach(uint32_t height);
|
|
|
|
void onError(const std::error_code& ec, uint32_t height);
|
|
|
|
bool advanceHeight(uint32_t height);
|
2015-04-06 16:13:07 +00:00
|
|
|
const AccountKeys& getKeys() const;
|
2015-12-09 13:19:03 +00:00
|
|
|
bool addTransaction(const TransactionBlockInfo& blockInfo, const ITransactionReader& tx,
|
2015-07-15 12:23:00 +00:00
|
|
|
const std::vector<TransactionOutputInformationIn>& transfers);
|
2015-04-06 16:13:07 +00:00
|
|
|
|
2015-07-30 15:22:07 +00:00
|
|
|
void deleteUnconfirmedTransaction(const Crypto::Hash& transactionHash);
|
2015-08-11 14:33:19 +00:00
|
|
|
void markTransactionConfirmed(const TransactionBlockInfo& block, const Crypto::Hash& transactionHash, const std::vector<uint32_t>& globalIndices);
|
2015-04-06 16:13:07 +00:00
|
|
|
|
|
|
|
// ITransfersSubscription
|
2015-07-30 15:22:07 +00:00
|
|
|
virtual AccountPublicAddress getAddress() override;
|
2015-04-06 16:13:07 +00:00
|
|
|
virtual ITransfersContainer& getContainer() override;
|
|
|
|
|
|
|
|
private:
|
2015-07-30 15:22:07 +00:00
|
|
|
TransfersContainer transfers;
|
|
|
|
AccountSubscription subscription;
|
2015-04-06 16:13:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|