aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
authormoneroexamples <moneroexamples@tuta.io>2017-07-04 12:32:44 +0800
committermoneroexamples <moneroexamples@tuta.io>2017-07-04 12:32:44 +0800
commit125f823bda3b6be2fdefa76d9a4e44615fd4a24f (patch)
tree1b80d542ae598c447e5bd10d9587b85e920b75f0 /src/rpc/core_rpc_server.cpp
parentMerge pull request #2130 (diff)
downloadmonero-125f823bda3b6be2fdefa76d9a4e44615fd4a24f.tar.xz
Add on_get_alt_blocks_hashes RPC call
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r--src/rpc/core_rpc_server.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 97fe18696..097958d24 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -227,6 +227,28 @@ namespace cryptonote
res.status = CORE_RPC_STATUS_OK;
return true;
}
+ bool core_rpc_server::on_get_alt_blocks_hashes(const COMMAND_RPC_GET_ALT_BLOCKS_HASHES::request& req, COMMAND_RPC_GET_ALT_BLOCKS_HASHES::response& res)
+ {
+ CHECK_CORE_BUSY();
+ std::list<block> blks;
+
+ if(!m_core.get_alternative_blocks(blks))
+ {
+ res.status = "Failed";
+ return false;
+ }
+
+ res.blks_hashes.reserve(blks.size());
+
+ for (auto const& blk: blks)
+ {
+ res.blks_hashes.push_back(epee::string_tools::pod_to_hex(get_block_hash(blk)));
+ }
+
+ MDEBUG("on_get_alt_blocks_hashes: " << blks.size() << " blocks " );
+ res.status = CORE_RPC_STATUS_OK;
+ return true;
+ }
//------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::on_get_blocks_by_height(const COMMAND_RPC_GET_BLOCKS_BY_HEIGHT::request& req, COMMAND_RPC_GET_BLOCKS_BY_HEIGHT::response& res)
{