diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-03-17 10:15:33 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-03-19 09:05:40 +0000 |
commit | a6a54fa883996b1bfb33e737b979add1a143324c (patch) | |
tree | e29d5fc04bf6cffd793848bdaa34fa4605f06dfa /src/cryptonote_core/blockchain.h | |
parent | Merge pull request #3429 (diff) | |
download | monero-a6a54fa883996b1bfb33e737b979add1a143324c.tar.xz |
blockchain: cache difficulty for next block
Takes about 10 ms, which takes pretty much all of the get_info
RPC, which is called pretty often from wallets.
Also add a new lock so we don't need to lock the blockchain lock,
which will avoid blocking for a long time when calling the getinfo
RPC while syncing. Users of get_difficulty_for_next_block who need
the lock will have locked it already.
Diffstat (limited to 'src/cryptonote_core/blockchain.h')
-rw-r--r-- | src/cryptonote_core/blockchain.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index 4423199de..70f616544 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -1006,6 +1006,10 @@ namespace cryptonote std::vector<difficulty_type> m_difficulties; uint64_t m_timestamps_and_difficulties_height; + epee::critical_section m_difficulty_lock; + crypto::hash m_difficulty_for_next_block_top_hash; + difficulty_type m_difficulty_for_next_block; + boost::asio::io_service m_async_service; boost::thread_group m_async_pool; std::unique_ptr<boost::asio::io_service::work> m_async_work_idle; |