diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-11 10:49:15 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-11 10:52:41 +0100 |
commit | 83bbea4c7f47d05933ec1b5baca2e9724561e49c (patch) | |
tree | acc999b802091f32227e66e677ae483398fe1d93 /src/cryptonote_core | |
parent | blockchain: remove dead code (diff) | |
download | monero-83bbea4c7f47d05933ec1b5baca2e9724561e49c.tar.xz |
Add a is_key_image_spent daemon command and RPC call
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 15 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_core.h | 5 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 31e46b534..4d90eec1e 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -515,6 +515,21 @@ namespace cryptonote return true; } //----------------------------------------------------------------------------------------------- + bool core::is_key_image_spent(const crypto::key_image &key_image) + { + return m_blockchain_storage.have_tx_keyimg_as_spent(key_image); + } + //----------------------------------------------------------------------------------------------- + bool core::are_key_images_spent(const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent) + { + spent.clear(); + BOOST_FOREACH(auto& ki, key_im) + { + spent.push_back(m_blockchain_storage.have_tx_keyimg_as_spent(ki)); + } + return true; + } + //----------------------------------------------------------------------------------------------- bool core::check_tx_inputs_keyimages_diff(const transaction& tx) { std::unordered_set<crypto::key_image> ki; diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index de953da07..d700b3b47 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -145,6 +145,9 @@ namespace cryptonote void stop(); + bool is_key_image_spent(const crypto::key_image& key_im); + bool are_key_images_spent(const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent); + private: bool add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block); bool add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block); @@ -157,8 +160,6 @@ namespace cryptonote bool check_tx_semantic(const transaction& tx, bool keeped_by_block); //check if tx already in memory pool or in main blockchain - bool is_key_image_spent(const crypto::key_image& key_im); - bool check_tx_ring_signature(const txin_to_key& tx, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig); bool is_tx_spendtime_unlocked(uint64_t unlock_time); bool update_miner_block_template(); |