Add a is_key_image_spent daemon command and RPC call

This commit is contained in:
moneromooo-monero 2015-08-11 10:49:15 +01:00
parent 35abef1b92
commit 83bbea4c7f
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
10 changed files with 139 additions and 2 deletions

View file

@ -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;

View file

@ -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();