diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-01-29 21:20:24 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-02-07 13:42:12 +0000 |
commit | bc61ae69bfb20d2bdfa3d3716691e316bdbb6cb5 (patch) | |
tree | 99d8c5284cfbeda4f957c1c6381a8234cb0efcde /src/cryptonote_core/tx_pool.h | |
parent | txpool: increase unmined tx expiry to three days (diff) | |
download | monero-bc61ae69bfb20d2bdfa3d3716691e316bdbb6cb5.tar.xz |
tx_pool: add a max pool size, settable with --max-txpool-size
Diffstat (limited to 'src/cryptonote_core/tx_pool.h')
-rw-r--r-- | src/cryptonote_core/tx_pool.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index b4ea5a8f4..19cd83ed9 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -198,11 +198,11 @@ namespace cryptonote /** * @brief loads pool state (if any) from disk, and initializes pool * - * @param config_folder folder name where pool state will be + * @param max_txpool_size the max size in bytes * * @return true */ - bool init(); + bool init(size_t max_txpool_size = 0); /** * @brief attempts to save the transaction pool state to disk @@ -362,6 +362,19 @@ namespace cryptonote */ size_t validate(uint8_t version); + /** + * @brief get the cumulative txpool size in bytes + * + * @return the cumulative txpool size in bytes + */ + size_t get_txpool_size() const; + + /** + * @brief set the max cumulative txpool size in bytes + * + * @param bytes the max cumulative txpool size in bytes + */ + void set_txpool_max_size(size_t bytes); #define CURRENT_MEMPOOL_ARCHIVE_VER 11 #define CURRENT_MEMPOOL_TX_DETAILS_ARCHIVE_VER 12 @@ -496,6 +509,13 @@ namespace cryptonote */ void mark_double_spend(const transaction &tx); + /** + * @brief prune lowest fee/byte txes till we're not above bytes + * + * if bytes is 0, use m_txpool_max_size + */ + void prune(size_t bytes = 0); + //TODO: confirm the below comments and investigate whether or not this // is the desired behavior //! map key images to transactions which spent them @@ -542,6 +562,9 @@ private: 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; }; } |