@@ -2094,17 +2094,15 @@ bool CScriptCheck::operator()() {
2094
2094
return VerifyScript (scriptSig, m_tx_out.scriptPubKey , witness, nFlags, CachingTransactionSignatureChecker (ptxTo, nIn, m_tx_out.nValue , cacheStore, *txdata), &error);
2095
2095
}
2096
2096
2097
- static CSHA256 g_scriptExecutionCacheHasher;
2098
-
2099
2097
ValidationCache::ValidationCache (const size_t script_execution_cache_bytes)
2100
2098
{
2101
2099
// Setup the salted hasher
2102
2100
uint256 nonce = GetRandHash ();
2103
2101
// We want the nonce to be 64 bytes long to force the hasher to process
2104
2102
// this chunk, which makes later hash computations more efficient. We
2105
2103
// 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 );
2108
2106
2109
2107
const auto [num_elems, approx_size_bytes] = m_script_execution_cache.setup_bytes (script_execution_cache_bytes);
2110
2108
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,
2148
2146
// properly commits to the scriptPubKey in the inputs view of that
2149
2147
// transaction).
2150
2148
uint256 hashCacheEntry;
2151
- CSHA256 hasher = g_scriptExecutionCacheHasher ;
2149
+ CSHA256 hasher = validation_cache. ScriptExecutionCacheHasher () ;
2152
2150
hasher.Write (UCharCast (tx.GetWitnessHash ().begin ()), 32 ).Write ((unsigned char *)&flags, sizeof (flags)).Finalize (hashCacheEntry.begin ());
2153
2151
AssertLockHeld (cs_main); // TODO: Remove this requirement by making CuckooCache not require external locks
2154
2152
if (validation_cache.m_script_execution_cache .contains (hashCacheEntry, !cacheFullScriptStore)) {
0 commit comments