diff options
author | Jaquee <jaquee.monero@gmail.com> | 2017-03-24 09:59:26 +0100 |
---|---|---|
committer | Jaquee <jaquee.monero@gmail.com> | 2017-03-24 09:59:26 +0100 |
commit | a8646b0957aa60ffb8f3c2db820db16e40398c4e (patch) | |
tree | 5103806500da4144c8c5778c652513bb87a3a4d8 /src/wallet/api | |
parent | Merge pull request #1912 (diff) | |
download | monero-a8646b0957aa60ffb8f3c2db820db16e40398c4e.tar.xz |
Wallet API: add hard fork info functions
Diffstat (limited to 'src/wallet/api')
-rw-r--r-- | src/wallet/api/wallet.cpp | 12 | ||||
-rw-r--r-- | src/wallet/api/wallet.h | 3 | ||||
-rw-r--r-- | src/wallet/api/wallet_manager.cpp | 20 | ||||
-rw-r--r-- | src/wallet/api/wallet_manager.h | 1 |
4 files changed, 14 insertions, 22 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index d5c2fbda2..fc2d6e755 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -1413,6 +1413,18 @@ bool WalletImpl::rescanSpent() } 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 Bitmonero = Monero; diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h index 456110908..c376dd6c1 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -99,7 +99,8 @@ public: bool watchOnly() const; bool rescanSpent(); 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, optional<uint64_t> amount, uint32_t mixin_count, diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp index 8e86c87b3..b2f947972 100644 --- a/src/wallet/api/wallet_manager.cpp +++ b/src/wallet/api/wallet_manager.cpp @@ -377,26 +377,6 @@ double WalletManagerImpl::miningHashRate() const 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 { cryptonote::COMMAND_RPC_GET_INFO::request ireq; diff --git a/src/wallet/api/wallet_manager.h b/src/wallet/api/wallet_manager.h index 677c105fb..033e8108f 100644 --- a/src/wallet/api/wallet_manager.h +++ b/src/wallet/api/wallet_manager.h @@ -59,7 +59,6 @@ public: uint64_t blockchainTargetHeight() const; uint64_t networkDifficulty() const; double miningHashRate() const; - void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const; uint64_t blockTarget() const; bool isMining() const; bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true); |