diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 53e991bb7..5cab6b2eb 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -3499,9 +3499,14 @@ bool Blockchain::have_tx_keyimges_as_spent(const transaction &tx) const LOG_PRINT_L3("Blockchain::" << __func__); for (const txin_v& in: tx.vin) { - CHECKED_GET_SPECIFIC_VARIANT(in, const txin_to_key, in_to_key, true); - if(have_tx_keyimg_as_spent(in_to_key.k_image)) + if (in.type() != typeid(txin_to_key)) + continue; + const auto &tokey_in = boost::get(in); + if(have_tx_keyimg_as_spent(tokey_in.k_image)) + { + LOG_PRINT_L1("Key image already spent in blockchain: " << epee::string_tools::pod_to_hex(tokey_in.k_image)); return true; + } } return false; } diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 2781f3550..a01ca5409 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -239,7 +239,7 @@ namespace cryptonote // TODO: Investigate why not? if(!kept_by_block) { - if(have_tx_keyimges_as_spent(tx, id)) + if(have_tx_keyimges_as_spent(tx, id) || m_blockchain.have_tx_keyimges_as_spent(tx)) { mark_double_spend(tx); LOG_PRINT_L1("Transaction with id= "<< id << " used already spent key images");