From 32ea0f2cf65ac805ffda0460315e41154b462e12 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Tue, 4 Oct 2022 14:35:38 +0200 Subject: [PATCH] Clear crypto cache more often --- src/p2pool.cpp | 5 +++-- src/side_chain.cpp | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p2pool.cpp b/src/p2pool.cpp index bd52d00..ae8726c 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -301,6 +301,9 @@ void p2pool::handle_miner_data(MinerData& data) "\n---------------------------------------------------------------------------------------------------------------" ); + // Tx secret keys from all miners change every block, so cache can be cleared here + clear_crypto_cache(); + if (!is_main_thread()) { update_block_template_async(); } @@ -1322,8 +1325,6 @@ void p2pool::cleanup_mainchain_data(uint64_t height) void p2pool::api_update_block_found(const ChainMain* data) { - clear_crypto_cache(); - if (!m_api) { return; } diff --git a/src/side_chain.cpp b/src/side_chain.cpp index f6f3b2b..0f678eb 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -32,6 +32,7 @@ #include "stratum_server.h" #include "params.h" #include "json_parsers.h" +#include "crypto.h" #include #include #include @@ -1621,6 +1622,8 @@ void SideChain::update_chain_tip(const PoolBlock* block) if (s) { s->reset_share_counters(); } + // Also clear cache because it has data from all old blocks now + clear_crypto_cache(); LOGINFO(0, log::LightCyan() << "SYNCHRONIZED"); } }