src/cryptonote_core/tx_pool.cpp
//---------------------------------------------------------------------------------
//TODO: investigate whether boolean return is appropriate
investigate whether boolean return is appropriate
investigate whether boolean return is appropriate
bool tx_memory_pool::remove_stuck_transactions()
  {
    CRITICAL_REGION_LOCAL(m_transactions_lock);
    for(auto it = m_transactions.begin(); it!= m_transactions.end();)
    {
      uint64_t tx_age = time(nullptr) - it->second.receive_time;
      if((tx_age > CRYPTONOTE_MEMPOOL_TX_LIVETIME && !it->second.kept_by_block) ||
         (tx_age > CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME && it->second.kept_by_block) )
      {
        LOG_PRINT_L1("Tx " << it->first << " removed from tx pool due to outdated, age: " << tx_age );
        remove_transaction_keyimages(it->second.tx);
        auto sorted_it = find_tx_in_sorted_container(it->first);
        if (sorted_it == m_txs_by_fee.end())
        {
          LOG_PRINT_L1("Removing tx " << it->first << " from tx pool, but it was not found in the sorted txs container!");
        }
        else
        {
          m_txs_by_fee.erase(sorted_it);
        }
        m_timed_out_transactions.insert(it->first);
        auto pit = it++;
        m_transactions.erase(pit);
      }else
        ++it;
    }
    return true;
  }
bool tx_memory_pool :: remove_stuck_transactions ( ) { CRITICAL_REGION_LOCAL ( m_transactions_lock ) ; for ( auto it = m_transactions . begin ( ) ; it != m_transactions . end ( ) ; ) { uint64_t tx_age = time ( nullptr ) - it -> second . receive_time ; if ( ( tx_age > CRYPTONOTE_MEMPOOL_TX_LIVETIME && ! it -> second . kept_by_block ) || ( tx_age > CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME && it -> second . kept_by_block ) ) { LOG_PRINT_L1 ( " " << it -> first << " " << tx_age ) ; remove_transaction_keyimages ( it -> second . tx ) ; auto sorted_it = find_tx_in_sorted_container ( it -> first ) ; if ( sorted_it == m_txs_by_fee . end ( ) ) { LOG_PRINT_L1 ( " " << it -> first << " " ) ; } else { m_txs_by_fee . erase ( sorted_it ) ; } m_timed_out_transactions . insert ( it -> first ) ; auto pit = it ++ ; m_transactions . erase ( pit ) ; } else ++ it ; } return true ; }
TODO: investigate whether boolean return is appropriate
TODO : investigate whether boolean return is appropriate