Monero
tx_pool.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2022, The Monero Project
2 //
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification, are
6 // permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice, this list of
9 // conditions and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 // of conditions and the following disclaimer in the documentation and/or other
13 // materials provided with the distribution.
14 //
15 // 3. Neither the name of the copyright holder nor the names of its contributors may be
16 // used to endorse or promote products derived from this software without specific
17 // prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 //
29 // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
30 
31 #pragma once
32 #include "include_base_utils.h"
33 
34 #include <atomic>
35 #include <set>
36 #include <tuple>
37 #include <unordered_map>
38 #include <unordered_set>
39 #include <queue>
40 #include <boost/serialization/version.hpp>
41 #include <boost/utility.hpp>
42 
43 #include "span.h"
44 #include "string_tools.h"
45 #include "syncobj.h"
46 #include "math_helper.h"
51 #include "crypto/hash.h"
54 
55 namespace cryptonote
56 {
57  class Blockchain;
58  /************************************************************************/
59  /* */
60  /************************************************************************/
61 
63  typedef std::pair<std::pair<double, std::time_t>, crypto::hash> tx_by_fee_and_receive_time_entry;
64 
65  class txCompare
66  {
67  public:
69  {
70  // sort by greatest first, not least
71  if (a.first.first > b.first.first) return true;
72  if (a.first.first < b.first.first) return false;
73 
74  if (a.first.second < b.first.second) return true;
75  if (a.first.second > b.first.second) return false;
76 
77  return memcmp(a.second.data, b.second.data, sizeof(crypto::hash)) < 0;
78  }
79  };
80 
82  typedef std::set<tx_by_fee_and_receive_time_entry, txCompare> sorted_tx_container;
83 
98  class tx_memory_pool: boost::noncopyable
99  {
100  public:
106  tx_memory_pool(Blockchain& bchs);
107 
108 
116  bool add_tx(transaction &tx, const crypto::hash &id, const cryptonote::blobdata &blob,
117  size_t tx_weight, tx_verification_context& tvc, relay_method tx_relay, bool relayed,
118  uint8_t version, uint8_t nic_verified_hf_version = 0);
119 
144  uint8_t version, uint8_t nic_verified_hf_version = 0);
145 
162  bool take_tx(const crypto::hash &id, transaction &tx, cryptonote::blobdata &txblob, size_t& tx_weight, uint64_t& fee, bool &relayed, bool &do_not_relay, bool &double_spend_seen, bool &pruned, bool suppress_missing_msgs = false);
163 
172  bool have_tx(const crypto::hash &id, relay_category tx_category) const;
173 
184  bool on_blockchain_inc(uint64_t new_block_height, const crypto::hash& top_block_id);
185 
196  bool on_blockchain_dec(uint64_t new_block_height, const crypto::hash& top_block_id);
197 
203  void on_idle();
204 
208  void lock() const;
209 
213  void unlock() const;
214 
215  // load/store operations
216 
225  bool init(size_t max_txpool_weight = 0, bool mine_stem_txes = false);
226 
236  bool deinit();
237 
251  bool fill_block_template(block &bl, size_t median_weight, uint64_t already_generated_coins, size_t &total_weight, uint64_t &fee, uint64_t &expected_reward, uint8_t version);
252 
260  void get_transactions(std::vector<transaction>& txs, bool include_sensitive = false) const;
261 
269  void get_transaction_hashes(std::vector<crypto::hash>& txs, bool include_sensitive = false) const;
270 
278  void get_transaction_backlog(std::vector<tx_backlog_entry>& backlog, bool include_sensitive = false) const;
279 
291  void get_block_template_backlog(std::vector<tx_block_template_backlog_entry>& backlog, bool include_sensitive = false) const;
292 
300  void get_transaction_stats(struct txpool_stats& stats, bool include_sensitive = false) const;
301 
314  bool get_transactions_and_spent_keys_info(std::vector<tx_info>& tx_infos, std::vector<spent_key_image_info>& key_image_infos, bool include_sensitive_data = false) const;
315 
326  bool get_pool_for_rpc(std::vector<cryptonote::rpc::tx_in_pool>& tx_infos, cryptonote::rpc::key_images_with_tx_hashes& key_image_infos) const;
327 
336  bool check_for_key_images(const std::vector<crypto::key_image>& key_images, std::vector<bool>& spent) const;
337 
347  bool get_transaction(const crypto::hash& h, cryptonote::blobdata& txblob, relay_category tx_category) const;
348 
365  bool get_relayable_transactions(std::vector<std::tuple<crypto::hash, cryptonote::blobdata, relay_method>>& txs);
366 
375  void set_relayed(epee::span<const crypto::hash> hashes, relay_method tx_relay, std::vector<bool> &just_broadcasted);
376 
382  size_t get_transactions_count(bool include_sensitive = false) const;
383 
391  std::string print_pool(bool short_format) const;
392 
404  size_t validate(uint8_t version);
405 
411  uint64_t cookie() const { return m_cookie; }
412 
418  size_t get_txpool_weight() const;
419 
425  void set_txpool_max_weight(size_t bytes);
426 
432  void reduce_txpool_weight(size_t weight);
433 
434 #define CURRENT_MEMPOOL_ARCHIVE_VER 11
435 #define CURRENT_MEMPOOL_TX_DETAILS_ARCHIVE_VER 13
436 
440  struct tx_details
441  {
444  size_t blob_size;
445  size_t weight;
449 
451 
455 
457 
462 
464 
469 
470  time_t receive_time;
471 
473  bool relayed;
475 
477  };
478 
482  bool get_transaction_info(const crypto::hash &txid, tx_details &td, bool include_sensitive_data, bool include_blob = false) const;
483 
487  bool get_transactions_info(const std::vector<crypto::hash>& txids, std::vector<std::pair<crypto::hash, tx_details>>& txs, bool include_sensitive_data = false) const;
488 
492  bool get_complement(const std::vector<crypto::hash> &hashes, std::vector<cryptonote::blobdata> &txes) const;
493 
499  bool get_pool_info(time_t start_time, bool include_sensitive, size_t max_tx_count, std::vector<std::pair<crypto::hash, tx_details>>& added_txs, std::vector<crypto::hash>& remaining_added_txids, std::vector<crypto::hash>& removed_txs, bool& incremental) const;
500 
501  private:
502 
509 
520 
529  bool have_tx_keyimg_as_spent(const crypto::key_image& key_im, const crypto::hash& txid) const;
530 
544  bool have_tx_keyimges_as_spent(const transaction& tx, const crypto::hash& txid) const;
545 
559 
568  static bool have_key_images(const std::unordered_set<crypto::key_image>& kic, const transaction_prefix& tx);
569 
578  static bool append_key_images(std::unordered_set<crypto::key_image>& kic, const transaction_prefix& tx);
579 
591  bool is_transaction_ready_to_go(txpool_tx_meta_t& txd, const crypto::hash &txid, const cryptonote::blobdata &txblob, transaction&tx) const;
592 
596  void mark_double_spend(const transaction &tx);
597 
603  void prune(size_t bytes = 0);
604 
605  void add_tx_to_transient_lists(const crypto::hash& txid, double fee, time_t receive_time);
606  void remove_tx_from_transient_lists(const cryptonote::sorted_tx_container::iterator& sorted_it, const crypto::hash& txid, bool sensitive);
607  void track_removed_tx(const crypto::hash& txid, bool sensitive);
608 
609  //TODO: confirm the below comments and investigate whether or not this
610  // is the desired behavior
612 
618  typedef std::unordered_map<crypto::key_image, std::unordered_set<crypto::hash>> key_images_container;
619 
620 #if defined(DEBUG_CREATE_BLOCK_TEMPLATE)
621 public:
622 #endif
624 #if defined(DEBUG_CREATE_BLOCK_TEMPLATE)
625 private:
626 #endif
627 
630 
631  //TODO: this time should be a named constant somewhere, not hard-coded
634 
635  //TODO: look into doing this better
638 
639  std::atomic<uint64_t> m_cookie;
640 
641  // Info when transactions entered the pool, accessible by txid
642  std::unordered_map<crypto::hash, time_t> m_added_txs_by_id;
643 
644  // Info at what time the pool started to track the adding of transactions
646 
648  {
650  bool sensitive;
651  };
652 
653  // Info about transactions that were removed from the pool, ordered by the time
654  // of deletion
655  std::multimap<time_t, removed_tx_info> m_removed_txs_by_time;
656 
657  // Info how far back in time the list of removed tx ids currently reaches
658  // (it gets shorted periodically to prevent overflow)
660 
668  sorted_tx_container::iterator find_tx_in_sorted_container(const crypto::hash& id) const;
669 
671  bool check_tx_inputs(const std::function<cryptonote::transaction&(void)> &get_tx, const crypto::hash &txid, uint64_t &max_used_block_height, crypto::hash &max_used_block_id, tx_verification_context &tvc, bool kept_by_block = false) const;
672 
674 
677  std::unordered_set<crypto::hash> m_timed_out_transactions;
678 
680 
684 
685  mutable std::unordered_map<crypto::hash, std::tuple<bool, tx_verification_context, uint64_t, crypto::hash>> m_input_cache;
686 
687  std::unordered_map<crypto::hash, transaction> m_parsed_tx_cache;
688 
690  std::atomic<time_t> m_next_check;
691  };
692 }
693 
694 namespace boost
695 {
696  namespace serialization
697  {
698  template<class archive_t>
699  void serialize(archive_t & ar, cryptonote::tx_memory_pool::tx_details& td, const unsigned int version)
700  {
701  ar & td.blob_size;
702  ar & td.fee;
703  ar & td.tx;
705  ar & td.max_used_block_id;
706  ar & td.last_failed_height;
707  ar & td.last_failed_id;
708  ar & td.receive_time;
709  ar & td.last_relayed_time;
710  ar & td.relayed;
711  if (version < 11)
712  return;
713  ar & td.kept_by_block;
714  if (version < 12)
715  return;
716  ar & td.do_not_relay;
717  if (version < 13)
718  return;
719  ar & td.weight;
720  }
721  }
722 }
725 
726 
727 
void on_idle()
action to take periodically
Definition: tx_pool.cpp:703
Definition: binary_utils.h:36
bool relayed
whether or not the transaction has been relayed to the network
Definition: tx_pool.h:473
#define CURRENT_MEMPOOL_ARCHIVE_VER
Definition: tx_pool.h:434
uint64_t cookie() const
return the cookie
Definition: tx_pool.h:411
bool operator()(const tx_by_fee_and_receive_time_entry &a, const tx_by_fee_and_receive_time_entry &b) const
Definition: tx_pool.h:68
crypto::hash max_used_block_id
the hash of the highest block referenced by an input
Definition: tx_pool.h:447
time_t m_removed_txs_start_time
Definition: tx_pool.h:659
crypto::hash last_failed_id
the hash of the highest block the transaction referenced when last checking it failed ...
Definition: tx_pool.h:468
uint64_t max_used_block_height
the height of the highest block referenced by an input
Definition: tx_pool.h:448
bool have_tx_keyimg_as_spent(const crypto::key_image &key_im, const crypto::hash &txid) const
check if a transaction in the pool has a given spent key image
Definition: tx_pool.cpp:1356
bool get_transactions_info(const std::vector< crypto::hash > &txids, std::vector< std::pair< crypto::hash, tx_details >> &txs, bool include_sensitive_data=false) const
get information about multiple transactions
Definition: tx_pool.cpp:651
Definition: tx_pool.h:65
binary_archive< false > ar
Definition: cold-outputs.cpp:54
Definition: portable_binary_archive.hpp:29
::std::string string
Definition: gtest-port.h:1097
Definition: cryptonote_basic.h:474
void serialize(Archive &a, std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Definition: unordered_containers_boost_serialization.h:126
size_t get_txpool_weight() const
get the cumulative txpool weight in bytes
Definition: tx_pool.cpp:370
void remove_tx_from_transient_lists(const cryptonote::sorted_tx_container::iterator &sorted_it, const crypto::hash &txid, bool sensitive)
Definition: tx_pool.cpp:1800
void get_transaction_hashes(std::vector< crypto::hash > &txs, bool include_sensitive=false) const
get a list of all transaction hashes in the pool
Definition: tx_pool.cpp:930
key_images_container m_spent_key_images
container for spent key images from the transactions in the pool
Definition: tx_pool.h:629
bool have_tx(const crypto::hash &id, relay_category tx_category) const
checks if the pool has a transaction with the given hash
Definition: tx_pool.cpp:1336
bool remove_stuck_transactions()
remove old transactions from the pool
Definition: tx_pool.cpp:718
epee::critical_section m_transactions_lock
lock for the pool
Definition: tx_pool.h:623
std::atomic< time_t > m_next_check
Next timestamp that a DB check for relayable txes is allowed.
Definition: tx_pool.h:690
std::unordered_map< crypto::hash, transaction > m_parsed_tx_cache
Definition: tx_pool.h:687
void mark_double_spend(const transaction &tx)
mark all transactions double spending the one passed
Definition: tx_pool.cpp:1471
std::unordered_set< crypto::hash > m_timed_out_transactions
transactions which are unlikely to be included in blocks
Definition: tx_pool.h:677
crypto::hash txid
Definition: tx_pool.h:649
transaction tx
the transaction
Definition: tx_pool.h:442
static bool have_key_images(const std::unordered_set< crypto::key_image > &kic, const transaction_prefix &tx)
check if any of a transaction&#39;s spent key images are present in a given set
Definition: tx_pool.cpp:1449
Non-owning sequence of data. Does not deep copy.
Definition: span.h:54
sorted_tx_container::iterator find_tx_in_sorted_container(const crypto::hash &id) const
get an iterator to a transaction in the sorted container
Definition: tx_pool.cpp:708
bool do_not_relay
to avoid relay this transaction to the network
Definition: tx_pool.h:474
void set_relayed(epee::span< const crypto::hash > hashes, relay_method tx_relay, std::vector< bool > &just_broadcasted)
tell the pool that certain transactions were just relayed
Definition: tx_pool.cpp:851
unsigned char uint8_t
Definition: stdint.h:124
bool check_tx_inputs(const std::function< cryptonote::transaction &(void)> &get_tx, const crypto::hash &txid, uint64_t &max_used_block_height, crypto::hash &max_used_block_id, tx_verification_context &tvc, bool kept_by_block=false) const
cache/call Blockchain::check_tx_inputs results
Definition: tx_pool.cpp:1381
std::multimap< time_t, removed_tx_info > m_removed_txs_by_time
Definition: tx_pool.h:655
void get_transaction_stats(struct txpool_stats &stats, bool include_sensitive=false) const
get a summary statistics of all transaction hashes in the pool
Definition: tx_pool.cpp:1091
struct hash_func hashes[]
time_t receive_time
the time when the transaction entered the pool
Definition: tx_pool.h:470
bool get_pool_info(time_t start_time, bool include_sensitive, size_t max_tx_count, std::vector< std::pair< crypto::hash, tx_details >> &added_txs, std::vector< crypto::hash > &remaining_added_txids, std::vector< crypto::hash > &removed_txs, bool &incremental) const
get info necessary for update of pool-related info in a wallet, preferably incremental ...
Definition: tx_pool.cpp:942
std::unordered_map< crypto::key_image, std::vector< crypto::hash > > key_images_with_tx_hashes
Definition: message_data_structs.h:107
void get_block_template_backlog(std::vector< tx_block_template_backlog_entry > &backlog, bool include_sensitive=false) const
get (hash, weight, fee) for transactions in the pool - the minimum required information to create a b...
Definition: tx_pool.cpp:1030
bool insert_key_images(const transaction_prefix &tx, const crypto::hash &txid, relay_method tx_relay)
insert key images into m_spent_key_images
Definition: tx_pool.cpp:472
boost::string_ref blobdata_ref
Definition: blobdatatype.h:40
Definition: cryptonote_basic.h:170
std::unordered_map< crypto::hash, time_t > m_added_txs_by_id
Definition: tx_pool.h:642
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:44
cryptonote::blobdata tx_blob
the transaction&#39;s binary blob
Definition: tx_pool.h:443
Definition: verification_context.h:40
bool on_blockchain_inc(uint64_t new_block_height, const crypto::hash &top_block_id)
action to take when notified of a block added to the blockchain
Definition: tx_pool.cpp:1320
size_t validate(uint8_t version)
remove transactions from the pool which are no longer valid
Definition: tx_pool.cpp:1693
Definition: syncobj.h:81
std::unordered_map< crypto::hash, std::tuple< bool, tx_verification_context, uint64_t, crypto::hash > > m_input_cache
Definition: tx_pool.h:685
bool get_relayable_transactions(std::vector< std::tuple< crypto::hash, cryptonote::blobdata, relay_method >> &txs)
get a list of all relayable transactions and their hashes
Definition: tx_pool.cpp:773
#define CURRENT_MEMPOOL_TX_DETAILS_ARCHIVE_VER
Definition: tx_pool.h:435
std::pair< std::pair< double, std::time_t >, crypto::hash > tx_by_fee_and_receive_time_entry
pair of <transaction fee, transaction hash> for organization
Definition: tx_pool.h:57
size_t blob_size
the transaction&#39;s size
Definition: tx_pool.h:444
unsigned __int64 uint64_t
Definition: stdint.h:136
uint64_t last_failed_height
the highest block the transaction referenced when last checking it failed
Definition: tx_pool.h:461
bool init(size_t max_txpool_weight=0, bool mine_stem_txes=false)
loads pool state (if any) from disk, and initializes pool
Definition: tx_pool.cpp:1861
bool m_mine_stem_txes
Definition: tx_pool.h:683
uint64_t fee
the transaction&#39;s fee amount
Definition: tx_pool.h:446
size_t m_txpool_weight
Definition: tx_pool.h:682
version
Supported socks variants.
Definition: socks.h:57
bool take_tx(const crypto::hash &id, transaction &tx, cryptonote::blobdata &txblob, size_t &tx_weight, uint64_t &fee, bool &relayed, bool &do_not_relay, bool &double_spend_seen, bool &pruned, bool suppress_missing_msgs=false)
takes a transaction with the given hash from the pool
Definition: tx_pool.cpp:533
relay_method tx_relay
Definition: levin_notify.cpp:549
tx_memory_pool(Blockchain &bchs)
Constructor.
Definition: tx_pool.cpp:125
size_t weight
the transaction&#39;s weight
Definition: tx_pool.h:445
static bool append_key_images(std::unordered_set< crypto::key_image > &kic, const transaction_prefix &tx)
append the key images from a transaction to the given set
Definition: tx_pool.cpp:1460
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
Transaction pool, handles transactions which are not part of a block.
Definition: tx_pool.h:98
std::string blobdata
Definition: blobdatatype.h:39
Definition: core_rpc_server_commands_defs.h:1680
bool get_complement(const std::vector< crypto::hash > &hashes, std::vector< cryptonote::blobdata > &txes) const
get transactions not in the passed set
Definition: tx_pool.cpp:670
void unlock() const
unlocks the transaction pool
Definition: tx_pool.cpp:1376
bool deinit()
attempts to save the transaction pool state to disk
Definition: tx_pool.cpp:1929
bool add_tx(transaction &tx, const crypto::hash &id, const cryptonote::blobdata &blob, size_t tx_weight, tx_verification_context &tvc, relay_method tx_relay, bool relayed, uint8_t version, uint8_t nic_verified_hf_version=0)
Definition: tx_pool.cpp:138
bool have_tx_keyimges_as_spent(const transaction &tx, const crypto::hash &txid) const
check if any spent key image in a transaction is in the pool
Definition: tx_pool.cpp:1343
information about a single transaction
Definition: tx_pool.h:440
void track_removed_tx(const crypto::hash &txid, bool sensitive)
Definition: tx_pool.cpp:1823
POD_CLASS key_image
Definition: crypto.h:92
std::set< tx_by_fee_and_receive_time_entry, txCompare > sorted_tx_container
container for sorting transactions by fee per unit size
Definition: tx_pool.h:82
a struct containing txpool per transaction metadata
Definition: blockchain_db.h:154
bool sensitive
Definition: tx_pool.h:650
bool get_transactions_and_spent_keys_info(std::vector< tx_info > &tx_infos, std::vector< spent_key_image_info > &key_image_infos, bool include_sensitive_data=false) const
get information about all transactions and key images in the pool
Definition: tx_pool.cpp:1178
void set_txpool_max_weight(size_t bytes)
set the max cumulative txpool weight in bytes
Definition: tx_pool.cpp:376
bool kept_by_block
whether or not the transaction has been in a block before
Definition: tx_pool.h:454
void get_transactions(std::vector< transaction > &txs, bool include_sensitive=false) const
get a list of all transactions in the pool
Definition: tx_pool.cpp:910
cryptonote::transaction tx
Definition: transaction.cpp:40
bool fill_block_template(block &bl, size_t median_weight, uint64_t already_generated_coins, size_t &total_weight, uint64_t &fee, uint64_t &expected_reward, uint8_t version)
Chooses transactions for a block to include.
Definition: tx_pool.cpp:1548
void prune(size_t bytes=0)
prune lowest fee/byte txes till we&#39;re not above bytes
Definition: tx_pool.cpp:395
void reduce_txpool_weight(size_t weight)
reduce the cumulative txpool weight by the weight provided
Definition: tx_pool.cpp:382
BOOST_CLASS_VERSION(nodetool::peerlist_types, nodetool::CURRENT_PEERLIST_STORAGE_ARCHIVE_VER)
epee::math_helper::once_a_time_seconds< 30 > m_remove_stuck_tx_interval
interval on which to check for stale/"stuck" transactions
Definition: tx_pool.h:633
relay_method
Methods tracking how a tx was received and relayed.
Definition: enums.h:36
POD_CLASS hash
Definition: hash.h:49
bool on_blockchain_dec(uint64_t new_block_height, const crypto::hash &top_block_id)
action to take when notified of a block removed from the blockchain
Definition: tx_pool.cpp:1328
time_t last_relayed_time
the last time the transaction was relayed to the network
Definition: tx_pool.h:472
size_t m_txpool_max_weight
Definition: tx_pool.h:681
bool remove_transaction_keyimages(const transaction_prefix &tx, const crypto::hash &txid)
forget a transaction&#39;s spent key images
Definition: tx_pool.cpp:503
void add_tx_to_transient_lists(const crypto::hash &txid, double fee, time_t receive_time)
Definition: tx_pool.cpp:1761
sorted_tx_container m_txs_by_fee_and_receive_time
< container for transactions organized by fee per size and receive time
Definition: tx_pool.h:637
bool get_transaction(const crypto::hash &h, cryptonote::blobdata &txblob, relay_category tx_category) const
get a specific transaction from the pool
Definition: tx_pool.cpp:1306
bool check_for_key_images(const std::vector< crypto::key_image > &key_images, std::vector< bool > &spent) const
check for presence of key images in the pool
Definition: tx_pool.cpp:1284
void lock() const
locks the transaction pool
Definition: tx_pool.cpp:1371
relay_category
Definition: blockchain_db.h:109
bool double_spend_seen
true iff another tx was seen double spending this one
Definition: tx_pool.h:476
void get_transaction_backlog(std::vector< tx_backlog_entry > &backlog, bool include_sensitive=false) const
get (weight, fee, receive time) for all transaction in the pool
Definition: tx_pool.cpp:1017
Blockchain & m_blockchain
reference to the Blockchain object
Definition: tx_pool.h:679
static uint64_t h
Definition: blockchain_stats.cpp:55
Definition: cryptonote_basic.h:204
bool get_transaction_info(const crypto::hash &txid, tx_details &td, bool include_sensitive_data, bool include_blob=false) const
get infornation about a single transaction
Definition: tx_pool.cpp:591
time_t m_added_txs_start_time
Definition: tx_pool.h:645
bool get_pool_for_rpc(std::vector< cryptonote::rpc::tx_in_pool > &tx_infos, cryptonote::rpc::key_images_with_tx_hashes &key_image_infos) const
get information about all transactions and key images in the pool
Definition: tx_pool.cpp:1236
std::atomic< uint64_t > m_cookie
incremented at each change
Definition: tx_pool.h:639
cryptonote::block b
Definition: block.cpp:40
bool is_transaction_ready_to_go(txpool_tx_meta_t &txd, const crypto::hash &txid, const cryptonote::blobdata_ref &txblob, transaction &tx) const
check if a transaction is a valid candidate for inclusion in a block
Definition: tx_pool.cpp:1400
std::string print_pool(bool short_format) const
get a string containing human-readable pool information
Definition: tx_pool.cpp:1515
Definition: blockchain.h:102
size_t get_transactions_count(bool include_sensitive=false) const
get the total number of transactions in the pool
Definition: tx_pool.cpp:903
std::unordered_map< crypto::key_image, std::unordered_set< crypto::hash > > key_images_container
map key images to transactions which spent them
Definition: tx_pool.h:618