You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
2.3 KiB
115 lines
2.3 KiB
//
|
|
// Created by mwo on 5/11/15.
|
|
//
|
|
|
|
#ifndef XMREG01_MICROCORE_H
|
|
#define XMREG01_MICROCORE_H
|
|
|
|
#include <iostream>
|
|
#include <random>
|
|
|
|
#include "monero_headers.h"
|
|
#include "tools.h"
|
|
|
|
namespace xmreg
|
|
{
|
|
using namespace cryptonote;
|
|
using namespace crypto;
|
|
using namespace std;
|
|
|
|
/**
|
|
* Micro version of cryptonode::core class
|
|
* Micro version of constructor,
|
|
* init and destructor are implemted.
|
|
*
|
|
* Just enough to read the blockchain
|
|
* database for use in the example.
|
|
*/
|
|
class MicroCore {
|
|
|
|
string blockchain_path;
|
|
|
|
Blockchain core_storage;
|
|
tx_memory_pool m_mempool;
|
|
|
|
hw::device* m_device;
|
|
|
|
network_type nettype;
|
|
|
|
public:
|
|
MicroCore();
|
|
|
|
bool
|
|
init(const string& _blockchain_path, network_type nt);
|
|
|
|
Blockchain const&
|
|
get_core() const;
|
|
|
|
tx_memory_pool const&
|
|
get_mempool() const;
|
|
|
|
template<typename... T>
|
|
auto get_output_key(T&&... args)
|
|
{
|
|
return core_storage.get_db().get_output_key(std::forward<T>(args)...);
|
|
}
|
|
|
|
template <typename... T>
|
|
auto get_transactions(T&&... args)
|
|
{
|
|
return core_storage.get_transactions(std::forward<T>(args)...);
|
|
}
|
|
|
|
template <typename... T>
|
|
auto get_blocks_range(T&&... args)
|
|
{
|
|
return core_storage.get_db().get_blocks_range(std::forward<T>(args)...);
|
|
}
|
|
|
|
template <typename... T>
|
|
auto have_tx(T&&... args)
|
|
{
|
|
return core_storage.have_tx(std::forward<T>(args)...);
|
|
}
|
|
|
|
template<typename... T>
|
|
auto tx_exists(T&&... args)
|
|
{
|
|
return core_storage.get_db().tx_exists(std::forward<T>(args)...);
|
|
}
|
|
|
|
template<typename... T>
|
|
auto get_output_tx_and_index(T&&... args)
|
|
{
|
|
return core_storage.get_db().get_output_tx_and_index(std::forward<T>(args)...);
|
|
}
|
|
|
|
template<typename... T>
|
|
auto get_tx_block_height(T&&... args)
|
|
{
|
|
return core_storage.get_db().get_tx_block_height(std::forward<T>(args)...);
|
|
}
|
|
|
|
template<typename... T>
|
|
auto get_tx_amount_output_indices(T&&... args)
|
|
{
|
|
return core_storage.get_db().get_tx_amount_output_indices(std::forward<T>(args)...);
|
|
}
|
|
|
|
bool
|
|
get_block_from_height(const uint64_t& height, block& blk);
|
|
|
|
bool
|
|
get_tx(const crypto::hash& tx_hash, transaction& tx);
|
|
|
|
hw::device* const
|
|
get_device() const;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //XMREG01_MICROCORE_H
|