Cache: save data from previous Monero block too

To improve caching of stale/outdated sidechain blocks.
This commit is contained in:
SChernykh
2023-03-31 12:52:17 +02:00
parent 080fbaa26c
commit 03eddddc0e
4 changed files with 63 additions and 13 deletions
+5 -1
View File
@@ -56,6 +56,7 @@ p2pool::p2pool(int argc, char* argv[])
, m_submitBlockData{}
, m_zmqLastActive(0)
, m_startTime(seconds_since_epoch())
, m_lastMinerDataReceived(0)
{
LOGINFO(1, log::LightCyan() << VERSION);
@@ -335,9 +336,12 @@ void p2pool::handle_miner_data(MinerData& data)
// Tx secret keys from all miners change every block, so cache can be cleared here
if (m_sideChain->precalcFinished()) {
clear_crypto_cache();
// Clear all cache entries older than the previous miner data
clear_crypto_cache(m_lastMinerDataReceived);
}
m_lastMinerDataReceived = seconds_since_epoch();
if (!is_main_thread()) {
update_block_template_async();
}