diff options
Diffstat (limited to 'src/cryptonote_core/tx_pool.cpp')
-rw-r--r-- | src/cryptonote_core/tx_pool.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index f6dbf1414..12fd3fe62 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -128,7 +128,11 @@ namespace cryptonote crypto::hash max_used_block_id = null_hash; uint64_t max_used_block_height = 0; +#if BLOCKCHAIN_DB == DB_LMDB + bool ch_inp_res = m_blockchain.check_tx_inputs(tx, max_used_block_height, max_used_block_id, kept_by_block); +#else bool ch_inp_res = m_blockchain.check_tx_inputs(tx, max_used_block_height, max_used_block_id); +#endif CRITICAL_REGION_LOCAL(m_transactions_lock); if(!ch_inp_res) { @@ -203,6 +207,9 @@ namespace cryptonote bool tx_memory_pool::remove_transaction_keyimages(const transaction& tx) { CRITICAL_REGION_LOCAL(m_transactions_lock); + // ND: Speedup + // 1. Move transaction hash calcuation outside of loop. ._. + crypto::hash actual_hash = get_transaction_hash(tx); BOOST_FOREACH(const txin_v& vi, tx.vin) { CHECKED_GET_SPECIFIC_VARIANT(vi, const txin_to_key, txin, false); @@ -211,11 +218,11 @@ namespace cryptonote << "transaction id = " << get_transaction_hash(tx)); std::unordered_set<crypto::hash>& key_image_set = it->second; CHECK_AND_ASSERT_MES(key_image_set.size(), false, "empty key_image set, img=" << txin.k_image << ENDL - << "transaction id = " << get_transaction_hash(tx)); + << "transaction id = " << actual_hash); - auto it_in_set = key_image_set.find(get_transaction_hash(tx)); + auto it_in_set = key_image_set.find(actual_hash); CHECK_AND_ASSERT_MES(it_in_set != key_image_set.end(), false, "transaction id not found in key_image set, img=" << txin.k_image << ENDL - << "transaction id = " << get_transaction_hash(tx)); + << "transaction id = " << actual_hash); key_image_set.erase(it_in_set); if(!key_image_set.size()) { |