aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/tx_pool.h
diff options
context:
space:
mode:
authorrbrunner7 <rbrunner@dreamshare.ch>2021-11-21 17:40:50 +0100
committerrbrunner7 <rbrunner@dreamshare.ch>2023-07-09 08:30:53 +0200
commit23f782b21113035b57e4560d6a9b522ac1f03cca (patch)
treea432fe92d5c787d3358c6ddc7ad61fd4f8b5ac2d /src/cryptonote_core/tx_pool.h
parentMerge pull request #8917 (diff)
downloadmonero-23f782b21113035b57e4560d6a9b522ac1f03cca.tar.xz
wallet2, RPC: Optimize RPC calls for periodic refresh from 3 down to 1 call [release-v0.18]
Diffstat (limited to 'src/cryptonote_core/tx_pool.h')
-rw-r--r--src/cryptonote_core/tx_pool.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h
index 45623fd14..3e099cf2d 100644
--- a/src/cryptonote_core/tx_pool.h
+++ b/src/cryptonote_core/tx_pool.h
@@ -461,6 +461,7 @@ namespace cryptonote
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
+ bool sensitive;
};
/**
@@ -473,6 +474,13 @@ namespace cryptonote
*/
bool get_complement(const std::vector<crypto::hash> &hashes, std::vector<cryptonote::blobdata> &txes) const;
+ /**
+ * @brief get info necessary for update of pool-related info in a wallet, preferably incremental
+ *
+ * @return true on success, false on error
+ */
+ bool get_pool_info(time_t start_time, bool include_sensitive, std::vector<tx_details>& added_txs, std::vector<crypto::hash>& removed_txs, bool& incremental) const;
+
private:
/**
@@ -577,6 +585,10 @@ namespace cryptonote
*/
void prune(size_t bytes = 0);
+ void add_tx_to_transient_lists(const crypto::hash& txid, double fee, time_t receive_time);
+ void remove_tx_from_transient_lists(const cryptonote::sorted_tx_container::iterator& sorted_it, const crypto::hash& txid, bool sensitive);
+ void track_removed_tx(const crypto::hash& txid, bool sensitive);
+
//TODO: confirm the below comments and investigate whether or not this
// is the desired behavior
//! map key images to transactions which spent them
@@ -609,6 +621,26 @@ private:
std::atomic<uint64_t> m_cookie; //!< incremented at each change
+ // Info when transactions entered the pool, accessible by txid
+ std::unordered_map<crypto::hash, time_t> m_added_txs_by_id;
+
+ // Info at what time the pool started to track the adding of transactions
+ time_t m_added_txs_start_time;
+
+ struct removed_tx_info
+ {
+ crypto::hash txid;
+ bool sensitive;
+ };
+
+ // Info about transactions that were removed from the pool, ordered by the time
+ // of deletion
+ std::multimap<time_t, removed_tx_info> m_removed_txs_by_time;
+
+ // Info how far back in time the list of removed tx ids currently reaches
+ // (it gets shorted periodically to prevent overflow)
+ time_t m_removed_txs_start_time;
+
/**
* @brief get an iterator to a transaction in the sorted container
*