mirror of
https://github.com/monero-project/monero.git
synced 2024-12-13 20:06:32 +02:00
Wallet API: add hard fork info functions
This commit is contained in:
parent
16f12f0628
commit
a8646b0957
@ -1413,6 +1413,18 @@ bool WalletImpl::rescanSpent()
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WalletImpl::hardForkInfo(uint8_t &version, uint64_t &earliest_height) const
|
||||||
|
{
|
||||||
|
m_wallet->get_hard_fork_info(version, earliest_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WalletImpl::useForkRules(uint8_t version, int64_t early_blocks) const
|
||||||
|
{
|
||||||
|
return m_wallet->use_fork_rules(version,early_blocks);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Monero;
|
namespace Bitmonero = Monero;
|
||||||
|
@ -99,7 +99,8 @@ public:
|
|||||||
bool watchOnly() const;
|
bool watchOnly() const;
|
||||||
bool rescanSpent();
|
bool rescanSpent();
|
||||||
bool testnet() const {return m_wallet->testnet();}
|
bool testnet() const {return m_wallet->testnet();}
|
||||||
|
void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const;
|
||||||
|
bool useForkRules(uint8_t version, int64_t early_blocks) const;
|
||||||
|
|
||||||
PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
|
PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
|
||||||
optional<uint64_t> amount, uint32_t mixin_count,
|
optional<uint64_t> amount, uint32_t mixin_count,
|
||||||
|
@ -377,26 +377,6 @@ double WalletManagerImpl::miningHashRate() const
|
|||||||
return mres.speed;
|
return mres.speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WalletManagerImpl::hardForkInfo(uint8_t &version, uint64_t &earliest_height) const
|
|
||||||
{
|
|
||||||
epee::json_rpc::request<cryptonote::COMMAND_RPC_HARD_FORK_INFO::request> req_t = AUTO_VAL_INIT(req_t);
|
|
||||||
epee::json_rpc::response<cryptonote::COMMAND_RPC_HARD_FORK_INFO::response, std::string> resp_t = AUTO_VAL_INIT(resp_t);
|
|
||||||
|
|
||||||
version = 0;
|
|
||||||
earliest_height = 0;
|
|
||||||
|
|
||||||
epee::net_utils::http::http_simple_client http_client;
|
|
||||||
req_t.jsonrpc = "2.0";
|
|
||||||
req_t.id = epee::serialization::storage_entry(0);
|
|
||||||
req_t.method = "hard_fork_info";
|
|
||||||
req_t.params.version = 0;
|
|
||||||
bool r = connect_and_invoke(m_daemonAddress, "/json_rpc", req_t, resp_t);
|
|
||||||
if (!r || resp_t.result.status != CORE_RPC_STATUS_OK)
|
|
||||||
return;
|
|
||||||
version = resp_t.result.version;
|
|
||||||
earliest_height = resp_t.result.earliest_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t WalletManagerImpl::blockTarget() const
|
uint64_t WalletManagerImpl::blockTarget() const
|
||||||
{
|
{
|
||||||
cryptonote::COMMAND_RPC_GET_INFO::request ireq;
|
cryptonote::COMMAND_RPC_GET_INFO::request ireq;
|
||||||
|
@ -59,7 +59,6 @@ public:
|
|||||||
uint64_t blockchainTargetHeight() const;
|
uint64_t blockchainTargetHeight() const;
|
||||||
uint64_t networkDifficulty() const;
|
uint64_t networkDifficulty() const;
|
||||||
double miningHashRate() const;
|
double miningHashRate() const;
|
||||||
void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const;
|
|
||||||
uint64_t blockTarget() const;
|
uint64_t blockTarget() const;
|
||||||
bool isMining() const;
|
bool isMining() const;
|
||||||
bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true);
|
bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true);
|
||||||
|
@ -296,7 +296,10 @@ struct Wallet
|
|||||||
virtual std::string address() const = 0;
|
virtual std::string address() const = 0;
|
||||||
virtual std::string path() const = 0;
|
virtual std::string path() const = 0;
|
||||||
virtual bool testnet() const = 0;
|
virtual bool testnet() const = 0;
|
||||||
|
//! returns current hard fork info
|
||||||
|
virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const = 0;
|
||||||
|
//! check if hard fork rules should be used
|
||||||
|
virtual bool useForkRules(uint8_t version, int64_t early_blocks) const = 0;
|
||||||
/*!
|
/*!
|
||||||
* \brief integratedAddress - returns integrated address for current wallet address and given payment_id.
|
* \brief integratedAddress - returns integrated address for current wallet address and given payment_id.
|
||||||
* if passed "payment_id" param is an empty string or not-valid payment id string
|
* if passed "payment_id" param is an empty string or not-valid payment id string
|
||||||
@ -686,9 +689,6 @@ struct WalletManager
|
|||||||
//! returns current mining hash rate (0 if not mining)
|
//! returns current mining hash rate (0 if not mining)
|
||||||
virtual double miningHashRate() const = 0;
|
virtual double miningHashRate() const = 0;
|
||||||
|
|
||||||
//! returns current hard fork info
|
|
||||||
virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const = 0;
|
|
||||||
|
|
||||||
//! returns current block target
|
//! returns current block target
|
||||||
virtual uint64_t blockTarget() const = 0;
|
virtual uint64_t blockTarget() const = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user