aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-11 10:49:15 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-11 10:52:41 +0100
commit83bbea4c7f47d05933ec1b5baca2e9724561e49c (patch)
treeacc999b802091f32227e66e677ae483398fe1d93 /src/rpc/core_rpc_server.cpp
parentblockchain: remove dead code (diff)
downloadmonero-83bbea4c7f47d05933ec1b5baca2e9724561e49c.tar.xz
Add a is_key_image_spent daemon command and RPC call
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r--src/rpc/core_rpc_server.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 24c7d242f..0c8384306 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -241,6 +241,35 @@ namespace cryptonote
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
+ bool core_rpc_server::on_is_key_image_spent(const COMMAND_RPC_IS_KEY_IMAGE_SPENT::request& req, COMMAND_RPC_IS_KEY_IMAGE_SPENT::response& res)
+ {
+ CHECK_CORE_BUSY();
+ std::vector<crypto::key_image> key_images;
+ BOOST_FOREACH(const auto& ki_hex_str, req.key_images)
+ {
+ blobdata b;
+ if(!string_tools::parse_hexstr_to_binbuff(ki_hex_str, b))
+ {
+ res.status = "Failed to parse hex representation of key image";
+ return true;
+ }
+ if(b.size() != sizeof(crypto::key_image))
+ {
+ res.status = "Failed, size of data mismatch";
+ }
+ key_images.push_back(*reinterpret_cast<const crypto::key_image*>(b.data()));
+ }
+ bool r = m_core.are_key_images_spent(key_images, res.spent_status);
+ if(!r)
+ {
+ res.status = "Failed";
+ return true;
+ }
+
+ res.status = CORE_RPC_STATUS_OK;
+ return true;
+ }
+ //------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::on_send_raw_tx(const COMMAND_RPC_SEND_RAW_TX::request& req, COMMAND_RPC_SEND_RAW_TX::response& res)
{
CHECK_CORE_READY();