diff options
author | Howard Chu <hyc@symas.com> | 2016-04-13 23:45:02 +0100 |
---|---|---|
committer | Howard Chu <hyc@symas.com> | 2016-04-17 15:25:46 +0100 |
commit | b7140daea2b33d03f65b852de7f1ce4b99661adf (patch) | |
tree | adbf2b2738cb198ac2122f9640e7e480317bfe86 /src/rpc/core_rpc_server.cpp | |
parent | Merge pull request #803 (diff) | |
download | monero-b7140daea2b33d03f65b852de7f1ce4b99661adf.tar.xz |
Add GET_HASHES_FAST rpc, use it in wallet
When m_refresh_from_block_height has been set, only hashes will be
retrieved up to that height, instead of full blocks. The same will
be done for "refresh <height>" when the specified height is beyond
the current local blockchain.
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 9fcb4373b..9e8d1108e 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -166,6 +166,25 @@ namespace cryptonote return true; } //------------------------------------------------------------------------------------------------------------------------------ + bool core_rpc_server::on_get_hashes(const COMMAND_RPC_GET_HASHES_FAST::request& req, COMMAND_RPC_GET_HASHES_FAST::response& res) + { + CHECK_CORE_BUSY(); + NOTIFY_RESPONSE_CHAIN_ENTRY::request resp; + + resp.start_height = req.start_height; + if(!m_core.find_blockchain_supplement(req.block_ids, resp)) + { + res.status = "Failed"; + return false; + } + res.current_height = resp.total_height; + res.start_height = resp.start_height; + res.m_block_ids = std::move(resp.m_block_ids); + + res.status = CORE_RPC_STATUS_OK; + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ bool core_rpc_server::on_get_random_outs(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res) { CHECK_CORE_BUSY(); |