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.
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user