Remove mining-related functions from wallet api

This commit is contained in:
Jason Rhinelander 2021-01-08 15:52:39 -04:00
parent 37159b2ba0
commit 265dca70ed
3 changed files with 0 additions and 54 deletions

View file

@ -1185,24 +1185,9 @@ struct WalletManagerBase
//! returns current blockchain target height
virtual uint64_t blockchainTargetHeight() = 0;
//! returns current network difficulty
virtual uint64_t networkDifficulty() = 0;
//! returns current mining hash rate (0 if not mining)
virtual double miningHashRate() = 0;
//! returns current block target
virtual uint64_t blockTarget() = 0;
//! returns true iff mining
virtual bool isMining() = 0;
//! starts mining with the set number of threads
virtual bool startMining(const std::string& address, uint32_t threads = 1) = 0;
//! stops mining
virtual bool stopMining() = 0;
//! resolves an OpenAlias address to a monero address
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0;
};

View file

@ -264,18 +264,6 @@ uint64_t WalletManagerImpl::blockchainTargetHeight()
return std::max(res->target_height, res->height);
}
uint64_t WalletManagerImpl::networkDifficulty()
{
auto res = get_info(m_http_client);
return res ? res->difficulty : 0;
}
double WalletManagerImpl::miningHashRate()
{
auto mres = json_rpc<cryptonote::rpc::MINING_STATUS>(m_http_client);
return mres && mres->active ? mres->speed : 0.0;
}
EXPORT
uint64_t WalletManagerImpl::blockTarget()
{
@ -283,28 +271,6 @@ uint64_t WalletManagerImpl::blockTarget()
return res ? res->target : 0;
}
bool WalletManagerImpl::isMining()
{
auto mres = json_rpc<cryptonote::rpc::MINING_STATUS>(m_http_client);
return mres && mres->active;
}
bool WalletManagerImpl::startMining(const std::string &address, uint32_t threads)
{
cryptonote::rpc::START_MINING::request mreq{};
mreq.miner_address = address;
mreq.threads_count = threads;
auto mres = json_rpc<cryptonote::rpc::START_MINING>(m_http_client, mreq);
return mres && mres->status == cryptonote::rpc::STATUS_OK;
}
bool WalletManagerImpl::stopMining()
{
auto mres = json_rpc<cryptonote::rpc::STOP_MINING>(m_http_client);
return mres && mres->status == cryptonote::rpc::STATUS_OK;
}
EXPORT
std::string WalletManagerImpl::resolveOpenAlias(const std::string &address, bool &dnssec_valid) const
{

View file

@ -75,12 +75,7 @@ public:
bool connected(uint32_t *version = NULL) override;
uint64_t blockchainHeight() override;
uint64_t blockchainTargetHeight() override;
uint64_t networkDifficulty() override;
double miningHashRate() override;
uint64_t blockTarget() override;
bool isMining() override;
bool startMining(const std::string &address, uint32_t threads = 1) override;
bool stopMining() override;
std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const override;
private: