MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ValidationCache

Method ValidationCache

src/validation.cpp:2032–2046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2030}
2031
2032ValidationCache::ValidationCache(const size_t script_execution_cache_bytes, const size_t signature_cache_bytes)
2033 : m_signature_cache{signature_cache_bytes}
2034{
2035 // Setup the salted hasher
2036 uint256 nonce = GetRandHash();
2037 // We want the nonce to be 64 bytes long to force the hasher to process
2038 // this chunk, which makes later hash computations more efficient. We
2039 // just write our 32-byte entropy twice to fill the 64 bytes.
2040 m_script_execution_cache_hasher.Write(nonce.begin(), 32);
2041 m_script_execution_cache_hasher.Write(nonce.begin(), 32);
2042
2043 const auto [num_elems, approx_size_bytes] = m_script_execution_cache.setup_bytes(script_execution_cache_bytes);
2044 LogInfo("Using %zu MiB out of %zu MiB requested for script execution cache, able to store %zu elements",
2045 approx_size_bytes >> 20, script_execution_cache_bytes >> 20, num_elems);
2046}
2047
2048/**
2049 * Check whether all of this transaction's input scripts succeed.

Callers

nothing calls this directly

Calls 4

GetRandHashFunction · 0.85
setup_bytesMethod · 0.80
WriteMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected