Clear crypto derivation/key cache when a block is found

This commit is contained in:
SChernykh
2021-09-27 13:28:23 +02:00
parent 4fce76576f
commit 4bcaa41c8e
4 changed files with 18 additions and 2 deletions

View File

@@ -227,6 +227,14 @@ public:
return true;
}
void clear()
{
MutexLock lock(m);
derivations.clear();
public_keys.clear();
}
private:
uv_mutex_t m;
std::unordered_map<std::array<uint8_t, HASH_SIZE * 2>, hash> derivations;
@@ -245,4 +253,9 @@ bool derive_public_key(const hash& derivation, size_t output_index, const hash&
return cache.get_public_key(derivation, output_index, base, derived_key);
}
void clear_crypto_cache()
{
cache.clear();
}
} // namespace p2pool