danicoin/tests/IntegrationTestLib/TestWalletLegacy.h

48 lines
1.5 KiB
C
Raw Normal View History

// Copyright (c) 2011-2016 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2015-05-27 12:08:46 +00:00
#pragma once
2015-07-30 15:22:07 +00:00
#include "CryptoNoteCore/Currency.h"
2015-05-27 12:08:46 +00:00
#include "INode.h"
2015-07-30 15:22:07 +00:00
#include "IWalletLegacy.h"
2015-05-27 12:08:46 +00:00
#include "System/Dispatcher.h"
#include "System/Event.h"
2015-07-30 15:22:07 +00:00
#include "WalletLegacy/WalletLegacy.h"
2015-05-27 12:08:46 +00:00
namespace Tests {
namespace Common {
2015-07-30 15:22:07 +00:00
class TestWalletLegacy : private CryptoNote::IWalletLegacyObserver {
2015-05-27 12:08:46 +00:00
public:
2015-07-30 15:22:07 +00:00
TestWalletLegacy(System::Dispatcher& dispatcher, const CryptoNote::Currency& currency, CryptoNote::INode& node);
~TestWalletLegacy();
2015-05-27 12:08:46 +00:00
std::error_code init();
2015-07-30 15:22:07 +00:00
std::error_code sendTransaction(const std::string& address, uint64_t amount, Crypto::Hash& txHash);
2015-05-27 12:08:46 +00:00
void waitForSynchronizationToHeight(uint32_t height);
2015-07-30 15:22:07 +00:00
CryptoNote::IWalletLegacy* wallet();
2015-05-27 12:08:46 +00:00
CryptoNote::AccountPublicAddress address() const;
protected:
virtual void synchronizationCompleted(std::error_code result) override;
2015-07-30 15:22:07 +00:00
virtual void synchronizationProgressUpdated(uint32_t current, uint32_t total) override;
2015-05-27 12:08:46 +00:00
private:
System::Dispatcher& m_dispatcher;
System::Event m_synchronizationCompleted;
System::Event m_someTransactionUpdated;
CryptoNote::INode& m_node;
const CryptoNote::Currency& m_currency;
2015-07-30 15:22:07 +00:00
std::unique_ptr<CryptoNote::IWalletLegacy> m_wallet;
std::unique_ptr<CryptoNote::IWalletLegacyObserver> m_walletObserver;
2015-05-27 12:08:46 +00:00
uint32_t m_currentHeight;
uint32_t m_synchronizedHeight;
std::error_code m_lastSynchronizationResult;
};
}
}