kernel: De-globalize script execution cache hasher

Move it to the ChainstateManager class.
This commit is contained in:
TheCharlatan
2024-05-18 21:06:16 +02:00
parent 13a3661aba
commit 021d38822c
2 changed files with 10 additions and 5 deletions

View File

@@ -366,6 +366,10 @@ static_assert(std::is_nothrow_destructible_v<CScriptCheck>);
*/
class ValidationCache
{
private:
//! Pre-initialized hasher to avoid having to recreate it for every hash calculation.
CSHA256 m_script_execution_cache_hasher;
public:
CuckooCache::cache<uint256, SignatureCacheHasher> m_script_execution_cache;
@@ -373,6 +377,9 @@ public:
ValidationCache(const ValidationCache&) = delete;
ValidationCache& operator=(const ValidationCache&) = delete;
//! Return a copy of the pre-initialized hasher.
CSHA256 ScriptExecutionCacheHasher() const { return m_script_execution_cache_hasher; }
};
/** Functions for validating blocks and updating the block tree */