src/cryptonote_core/tx_pool.cpp
//---------------------------------------------------------------------------------
//TODO: investigate whether only ever returning true is correct
investigate whether only ever returning true is correct
investigate whether only ever returning true is correct
bool tx_memory_pool::init(const std::string& config_folder)
  {
    CRITICAL_REGION_LOCAL(m_transactions_lock);
    m_config_folder = config_folder;
    if (m_config_folder.empty())
      return true;
    std::string state_file_path = config_folder + "/" + CRYPTONOTE_POOLDATA_FILENAME;
    boost::system::error_code ec;
    if(!boost::filesystem::exists(state_file_path, ec))
      return true;
    bool res = tools::unserialize_obj_from_file(*this, state_file_path);
    if(!res)
    {
      LOG_PRINT_L1("Failed to load memory pool from file " << state_file_path);
      m_transactions.clear();
      m_txs_by_fee.clear();
      m_spent_key_images.clear();
    }
    for (const auto& tx : m_transactions)
    {
      m_txs_by_fee.emplace((double)tx.second.blob_size / tx.second.fee, tx.first);
    }
    return true;
  }
bool tx_memory_pool :: init ( const std :: string & config_folder ) { CRITICAL_REGION_LOCAL ( m_transactions_lock ) ; m_config_folder = config_folder ; if ( m_config_folder . empty ( ) ) return true ; std :: string state_file_path = config_folder + " " + CRYPTONOTE_POOLDATA_FILENAME ; boost :: system :: error_code ec ; if ( ! boost :: filesystem :: exists ( state_file_path , ec ) ) return true ; bool res = tools :: unserialize_obj_from_file ( * this , state_file_path ) ; if ( ! res ) { LOG_PRINT_L1 ( " " << state_file_path ) ; m_transactions . clear ( ) ; m_txs_by_fee . clear ( ) ; m_spent_key_images . clear ( ) ; } for ( const auto & tx : m_transactions ) { m_txs_by_fee . emplace ( ( double ) tx . second . blob_size / tx . second . fee , tx . first ) ; } return true ; }
TODO: investigate whether only ever returning true is correct
TODO : investigate whether only ever returning true is correct
// no need to store queue of sorted transactions, as it's easy to generate. // Ignore deserialization error