aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/tx_pool.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2020-11-15 00:08:10 -0500
committerLee Clagett <code@leeclagett.com>2020-11-15 00:08:10 -0500
commitd73cb95dfa5d6a5a70764fe53df46568af52bfbb (patch)
tree1cfe8297baa19d5b0094d37f30821d0e78a066e9 /src/cryptonote_core/tx_pool.h
parentMerge pull request #6927 (diff)
downloadmonero-d73cb95dfa5d6a5a70764fe53df46568af52bfbb.tar.xz
Fix timeout checks for forwarded and Dandelion++ stem txes
Diffstat (limited to 'src/cryptonote_core/tx_pool.h')
-rw-r--r--src/cryptonote_core/tx_pool.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h
index 8955d7551..ab2a57ea2 100644
--- a/src/cryptonote_core/tx_pool.h
+++ b/src/cryptonote_core/tx_pool.h
@@ -31,6 +31,7 @@
#pragma once
#include "include_base_utils.h"
+#include <atomic>
#include <set>
#include <tuple>
#include <unordered_map>
@@ -329,11 +330,14 @@ namespace cryptonote
* isn't old enough that relaying it is considered harmful
* Note a transaction can be "relayable" even if do_not_relay is true
*
+ * This function will skip all DB checks if an insufficient amount of
+ * time since the last call.
+ *
* @param txs return-by-reference the transactions and their hashes
*
- * @return true
+ * @return True if DB was checked, false if DB checks skipped.
*/
- bool get_relayable_transactions(std::vector<std::tuple<crypto::hash, cryptonote::blobdata, relay_method>>& txs) const;
+ bool get_relayable_transactions(std::vector<std::tuple<crypto::hash, cryptonote::blobdata, relay_method>>& txs);
/**
* @brief tell the pool that certain transactions were just relayed
@@ -609,6 +613,9 @@ private:
mutable std::unordered_map<crypto::hash, std::tuple<bool, tx_verification_context, uint64_t, crypto::hash>> m_input_cache;
std::unordered_map<crypto::hash, transaction> m_parsed_tx_cache;
+
+ //! Next timestamp that a DB check for relayable txes is allowed
+ std::atomic<time_t> m_next_check;
};
}