diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-04-17 11:04:01 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-08-16 12:44:33 +0000 |
commit | 82d1b74500aa7ffab47f428f9ca26bb43cc2d8af (patch) | |
tree | 4bf2f0630275fc66125c0db19853ce32aca12ac7 /src/cryptonote_core/tx_pool.h | |
parent | Merge pull request #4191 (diff) | |
download | monero-82d1b74500aa7ffab47f428f9ca26bb43cc2d8af.tar.xz |
core: cache block template where possible
This avoids constant rechecking of the same things each time
a miner asks for the block template. The tx pool maintains
a cookie to allow users to detect when the pool state changed,
which means the block template needs rebuilding.
Diffstat (limited to 'src/cryptonote_core/tx_pool.h')
-rw-r--r-- | src/cryptonote_core/tx_pool.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index 4ade7ddbe..4abfef85c 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -362,6 +362,13 @@ namespace cryptonote */ size_t validate(uint8_t version); + /** + * @brief return the cookie + * + * @return the cookie + */ + uint64_t cookie() const { return m_cookie; } + /** * @brief get the cumulative txpool size in bytes * @@ -549,6 +556,8 @@ private: //!< container for transactions organized by fee per size and receive time sorted_tx_container m_txs_by_fee_and_receive_time; + std::atomic<uint64_t> m_cookie; //!< incremented at each change + /** * @brief get an iterator to a transaction in the sorted container * |