diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index da8ea5042..6f8f16f4e 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -157,20 +157,10 @@ namespace cryptonote return false; } - if (version != nic_verified_hf_version && !cryptonote::ver_non_input_consensus(tx, tvc, version)) - { - LOG_PRINT_L1("transaction " << id << " failed non-input consensus rule checks"); - tvc.m_verifivation_failed = true; // should already be set, but just in case - return false; - } - - uint64_t fee; + const uint64_t fee = get_tx_fee(tx); bool fee_good = false; try { - // get_tx_fee() can throw. It shouldn't throw because we check preconditions in - // ver_non_input_consensus(), but let's put it in a try block just in case. - fee = get_tx_fee(tx); fee_good = kept_by_block || m_blockchain.check_fee(tx_weight, fee); } catch(...) {} @@ -217,6 +207,14 @@ namespace cryptonote } } + // Do more expensive verification after plausible no-drop offenses + if (version != nic_verified_hf_version && !cryptonote::ver_non_input_consensus(tx, tvc, version)) + { + LOG_PRINT_L1("transaction " << id << " failed non-input consensus rule checks"); + tvc.m_verifivation_failed = true; // should already be set, but just in case + return false; + } + // assume failure during verification steps until success is certain tvc.m_verifivation_failed = true; @@ -1360,7 +1358,9 @@ namespace cryptonote CRITICAL_REGION_LOCAL1(m_blockchain); for(const auto& in: tx.vin) { - CHECKED_GET_SPECIFIC_VARIANT(in, const txin_to_key, tokey_in, true);//should never fail + 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, txid)) return true; }