@@ -2094,17 +2094,15 @@ bool CScriptCheck::operator()() {
20942094 return VerifyScript (scriptSig, m_tx_out.scriptPubKey , witness, nFlags, CachingTransactionSignatureChecker (ptxTo, nIn, m_tx_out.nValue , cacheStore, *txdata), &error);
20952095}
20962096
2097- static CSHA256 g_scriptExecutionCacheHasher;
2098-
20992097ValidationCache::ValidationCache (const size_t script_execution_cache_bytes)
21002098{
21012099 // Setup the salted hasher
21022100 uint256 nonce = GetRandHash ();
21032101 // We want the nonce to be 64 bytes long to force the hasher to process
21042102 // this chunk, which makes later hash computations more efficient. We
21052103 // just write our 32-byte entropy twice to fill the 64 bytes.
2106- g_scriptExecutionCacheHasher .Write (nonce.begin (), 32 );
2107- g_scriptExecutionCacheHasher .Write (nonce.begin (), 32 );
2104+ m_script_execution_cache_hasher .Write (nonce.begin (), 32 );
2105+ m_script_execution_cache_hasher .Write (nonce.begin (), 32 );
21082106
21092107 const auto [num_elems, approx_size_bytes] = m_script_execution_cache.setup_bytes (script_execution_cache_bytes);
21102108 LogPrintf (" Using %zu MiB out of %zu MiB requested for script execution cache, able to store %zu elements\n " ,
@@ -2148,7 +2146,7 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
21482146 // properly commits to the scriptPubKey in the inputs view of that
21492147 // transaction).
21502148 uint256 hashCacheEntry;
2151- CSHA256 hasher = g_scriptExecutionCacheHasher ;
2149+ CSHA256 hasher = validation_cache. ScriptExecutionCacheHasher () ;
21522150 hasher.Write (UCharCast (tx.GetWitnessHash ().begin ()), 32 ).Write ((unsigned char *)&flags, sizeof (flags)).Finalize (hashCacheEntry.begin ());
21532151 AssertLockHeld (cs_main); // TODO: Remove this requirement by making CuckooCache not require external locks
21542152 if (validation_cache.m_script_execution_cache .contains (hashCacheEntry, !cacheFullScriptStore)) {
0 commit comments