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::get_relayable_transactions(std::list<std::pair<crypto::hash, cryptonote::transaction>> &txs) const
  {
    CRITICAL_REGION_LOCAL(m_transactions_lock);
    const time_t now = time(NULL);
    for(auto it = m_transactions.begin(); it!= m_transactions.end();)
    {
      if(it->second.fee > 0 && now - it->second.last_relayed_time > get_relay_delay(now, it->second.receive_time))
      {
        time_t max_age = it->second.kept_by_block ? CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME : CRYPTONOTE_MEMPOOL_TX_LIVETIME;
        if (now - it->second.receive_time <= max_age / 2)
        {
          txs.push_back(std::make_pair(it->first, it->second.tx));
        }
      }
      ++it;
    }
    return true;
  }
bool tx_memory_pool :: get_relayable_transactions ( std :: list < std :: pair < crypto :: hash , cryptonote :: transaction > > & txs ) const { CRITICAL_REGION_LOCAL ( m_transactions_lock ) ; const time_t now = time ( NULL ) ; for ( auto it = m_transactions . begin ( ) ; it != m_transactions . end ( ) ; ) { if ( it -> second . fee > 0 && now - it -> second . last_relayed_time > get_relay_delay ( now , it -> second . receive_time ) ) { time_t max_age = it -> second . kept_by_block ? CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME : CRYPTONOTE_MEMPOOL_TX_LIVETIME ; if ( now - it -> second . receive_time <= max_age / 2 ) { txs . push_back ( std :: make_pair ( it -> first , it -> second . tx ) ) ; } } ++ it ; } return true ; }
TODO: investigate whether boolean return is appropriate
TODO : investigate whether boolean return is appropriate
// 0 fee transactions are never relayed // if the tx is older than half the max lifetime, we don't re-relay it, to avoid a problem // mentioned by smooth where nodes would flush txes at slightly different times, causing // flushed txes to be re-added when received from a node which was just about to flush it