Skip to content

Commit

Permalink
Merge pull request #212 from graft-project/alpha4
Browse files Browse the repository at this point in the history
latest changes from alpha4
  • Loading branch information
AlexanderSuprunenko authored Feb 15, 2019
2 parents e93c20f + 77f515e commit b6bc81f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/rta/DaemonRpcClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ namespace graft {
class DaemonRpcClient
{
public:
DaemonRpcClient(const std::string &daemon_addr, const std::string &daemon_login, const std::string &daemon_pass);
DaemonRpcClient(const std::string &daemon_addr, const std::string &daemon_login, const std::string &daemon_pass,
boost::shared_ptr<boost::asio::io_service> ios);
virtual ~DaemonRpcClient();
bool get_tx_from_pool(const std::string &hash_str, cryptonote::transaction &out_tx);
bool get_tx(const std::string &hash_str, cryptonote::transaction &out_tx, uint64_t &block_num, bool &mined);
Expand Down
2 changes: 1 addition & 1 deletion include/rta/fullsupernodelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FullSupernodeList
static constexpr int64_t AUTH_SAMPLE_HASH_HEIGHT = 20; // block number for calculating auth sample should be calculated as current block height - AUTH_SAMPLE_HASH_HEIGHT;
static constexpr int64_t ANNOUNCE_TTL_SECONDS = 60 * 60; // if more than ANNOUNCE_TTL_SECONDS passed from last annouce - supernode excluded from auth sample selection

FullSupernodeList(const std::string &daemon_address, bool testnet = false);
FullSupernodeList(const std::string &daemon_address, boost::shared_ptr<boost::asio::io_service> ios, bool testnet = false);
~FullSupernodeList();
/**
* @brief add - adds supernode object to a list and owns it. caller doesn't need to delete an object
Expand Down
2 changes: 2 additions & 0 deletions include/rta/supernode.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ class Supernode
bool busy() const;


static boost::shared_ptr<boost::asio::io_service> getIoService() { return m_ioservice; }

private:
Supernode(bool testnet = false);

Expand Down
6 changes: 4 additions & 2 deletions src/rta/DaemonRpcClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ using namespace std;

namespace graft {

DaemonRpcClient::DaemonRpcClient(const std::string &daemon_addr, const std::string &daemon_login, const std::string &daemon_pass)
: m_rpc_timeout(std::chrono::seconds(30))
DaemonRpcClient::DaemonRpcClient(const std::string &daemon_addr, const std::string &daemon_login, const std::string &daemon_pass,
boost::shared_ptr<boost::asio::io_service> ios)
: m_http_client(ios)
, m_rpc_timeout(std::chrono::seconds(30))
{

boost::shared_mutex mutex;
Expand Down
4 changes: 2 additions & 2 deletions src/rta/fullsupernodelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ constexpr int32_t FullSupernodeList::TIERS, FullSupernodeList::ITEMS_PER_TIER, F
constexpr int64_t FullSupernodeList::AUTH_SAMPLE_HASH_HEIGHT, FullSupernodeList::ANNOUNCE_TTL_SECONDS;
#endif

FullSupernodeList::FullSupernodeList(const string &daemon_address, bool testnet)
FullSupernodeList::FullSupernodeList(const string &daemon_address, boost::shared_ptr<boost::asio::io_service> ios, bool testnet)
: m_daemon_address(daemon_address)
, m_testnet(testnet)
, m_rpc_client(daemon_address, "", "")
, m_rpc_client(daemon_address, "", "", ios)
, m_tp(new utils::ThreadPool())
{
m_refresh_counter = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/supernode/supernode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ void Supernode::prepareDataDir()

// create fullsupernode list instance and put it into global context
graft::FullSupernodeListPtr fsl = boost::make_shared<graft::FullSupernodeList>(
m_configEx.cryptonode_rpc_address, m_configEx.testnet);
m_configEx.cryptonode_rpc_address, graft::Supernode::getIoService(),
m_configEx.testnet);

fsl->add(supernode);

Expand Down

0 comments on commit b6bc81f

Please sign in to comment.