diff options
author | SChernykh <sergey.v.chernykh@gmail.com> | 2022-07-22 13:50:21 +0200 |
---|---|---|
committer | SChernykh <sergey.v.chernykh@gmail.com> | 2022-07-22 13:50:21 +0200 |
commit | 099fc1f8a9cd897b10ebfa280cd62a99f5666fa8 (patch) | |
tree | 4088f03284f3d6c1fd5d87a5842448dce1dfe97c /src/cryptonote_core/tx_pool.h | |
parent | Merge pull request #8435 (diff) | |
download | monero-099fc1f8a9cd897b10ebfa280cd62a99f5666fa8.tar.xz |
Fixed get_block_template_backlog performance
Before the fix, it processed all transactions in the mempool which could be very slow when mempool grows to several MBs in size. I observed `get_block_template_backlog` taking up to 15 seconds of CPU time under high mempool load.
After the fix, only transactions that can potentially be mined in the next block will be processed (a bit more than the current block median weight).
Diffstat (limited to 'src/cryptonote_core/tx_pool.h')
-rw-r--r-- | src/cryptonote_core/tx_pool.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index 62bef6c06..df58688ff 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -266,7 +266,11 @@ namespace cryptonote void get_transaction_backlog(std::vector<tx_backlog_entry>& backlog, bool include_sensitive = false) const; /** - * @brief get (hash, weight, fee) for all transactions in the pool - the minimum required information to create a block template + * @brief get (hash, weight, fee) for transactions in the pool - the minimum required information to create a block template + * + * Not all transactions in the pool will be returned for performance reasons + * If there are too many transactions in the pool, only the highest-paying transactions + * will be returned - but enough for the miner to create a full block * * @param backlog return-by-reference that data * @param include_sensitive return stempool, anonymity-pool, and unrelayed txes |