Monero
  • 介绍
  • 区块链
    • checkpoints
    • account
    • cryptonote_basic
    • cryptonote_basic_impl
    • cryptonote_stat_info
    • difficulty
    • hardfork
    • miner
    • subaddress_index
    • tx_extra
    • verification_context
    • blockchain
    • cryptonote_core
    • cryptonote_format_utils
    • cryptonote_core
    • cryptonote_tx_utils
    • tx_pool
  • API/客户端
    • command_server
    • electrum-words
    • core_rpc_server
    • simplewallet
    • wallet_rpc_server
    • wallet2
    • wallet2_api
  • 网络传输
    • connection_context
    • block_queue
    • cryptonote_protocol_defs
    • cryptonote_protocol_handler
    • net_node
    • net_peerlist
    • p2p_protocol_defs
  • 数据存储
    • blockchain_db
    • berkeleydb
    • lmdb
    • blockchain_import
    • blockchain_export
  • 数学/密码学
    • aesb
    • blake256
    • chacha
    • groestl
    • jh
    • keccak
    • random
    • skein
    • slow-hash
    • tree-hash
    • gen_multisig
    • multisig
    • bulletproofs
    • rctOps
    • rctSigs
Powered by GitBook
On this page

Was this helpful?

  1. 区块链

tx_pool

  //! pair of <transaction fee, transaction hash> for organization
  typedef std::pair<std::pair<double, std::time_t>, crypto::hash> tx_by_fee_and_receive_time_entry;
  //! container for sorting transactions by fee per unit size
  typedef std::set<tx_by_fee_and_receive_time_entry, txCompare> sorted_tx_container;
    /**
     * @brief information about a single transaction
     */
    struct tx_details
    {
      transaction tx;  //!< the transaction
      size_t blob_size;  //!< the transaction's size
      uint64_t fee;  //!< the transaction's fee amount
      crypto::hash max_used_block_id;  //!< the hash of the highest block referenced by an input
      uint64_t max_used_block_height;  //!< the height of the highest block referenced by an input

      //! whether or not the transaction has been in a block before
      /*! if the transaction was returned to the pool from the blockchain
       *  due to a reorg, then this will be true
       */
      bool kept_by_block;  

      //! the highest block the transaction referenced when last checking it failed
      /*! if verifying a transaction's inputs fails, it's possible this is due
       *  to a reorg since it was created (if it used recently created outputs
       *  as inputs).
       */
      uint64_t last_failed_height;  

      //! the hash of the highest block the transaction referenced when last checking it failed
      /*! if verifying a transaction's inputs fails, it's possible this is due
       *  to a reorg since it was created (if it used recently created outputs
       *  as inputs).
       */
      crypto::hash last_failed_id;

      time_t receive_time;  //!< the time when the transaction entered the pool

      time_t last_relayed_time;  //!< the last time the transaction was relayed to the network
      bool relayed;  //!< whether or not the transaction has been relayed to the network
      bool do_not_relay; //!< to avoid relay this transaction to the network

      bool double_spend_seen; //!< true iff another tx was seen double spending this one
    };
    typedef std::unordered_map<crypto::key_image, std::unordered_set<crypto::hash> > key_images_container;
    //! container for spent key images from the transactions in the pool
    key_images_container m_spent_key_images;  

    //TODO: this time should be a named constant somewhere, not hard-coded
    //! interval on which to check for stale/"stuck" transactions
    epee::math_helper::once_a_time_seconds<30> m_remove_stuck_tx_interval;

    //TODO: look into doing this better
    //!< container for transactions organized by fee per size and receive time
    sorted_tx_container m_txs_by_fee_and_receive_time;

    std::unordered_set<crypto::hash> m_timed_out_transactions;

    Blockchain& m_blockchain;  //!< reference to the Blockchain object

    size_t m_txpool_max_size;
    size_t m_txpool_size;
Previouscryptonote_tx_utilsNextAPI/客户端

Last updated 5 years ago

Was this helpful?