6#ifndef BITCOIN_SCRIPT_SIGCACHE_H
7#define BITCOIN_SCRIPT_SIGCACHE_H
17#include <shared_mutex>
50 const std::vector<uint8_t> &vchSig,
53 bool Get(
const uint256 &entry,
const bool erase);
63 bool IsCached(
const std::vector<uint8_t> &vchSig,
const CPubKey &vchPubKey,
69 const Amount amountIn,
bool storeIn,
77 const uint256 &sighash)
const override;
An encapsulated public key.
A hasher class for SHA-256.
The basic transaction that is broadcasted on the network and contained in blocks.
friend class TestCachingTransactionSignatureChecker
bool VerifySignature(const std::vector< uint8_t > &vchSig, const CPubKey &vchPubKey, const uint256 &sighash) const override
bool IsCached(const std::vector< uint8_t > &vchSig, const CPubKey &vchPubKey, const uint256 &sighash) const
SignatureCache & m_signature_cache
CachingTransactionSignatureChecker(const CTransaction *txToIn, unsigned int nInIn, const Amount amountIn, bool storeIn, SignatureCache &signature_cache, PrecomputedTransactionData &txdataIn)
cache implements a cache with properties similar to a cuckoo-set.
We're hashing a nonce into the entries themselves, so we don't need extra blinding in the set hash co...
Valid signature cache, to avoid doing expensive ECDSA signature checking twice for every transaction ...
SignatureCache(size_t max_size_bytes)
void ComputeEntry(uint256 &entry, const uint256 &hash, const std::vector< uint8_t > &vchSig, const CPubKey &pubkey) const
CSHA256 m_salted_hasher
Entries are SHA256(nonce || signature hash || public key || signature):
std::shared_mutex cs_sigcache
SignatureCache & operator=(const SignatureCache &)=delete
SignatureCache(const SignatureCache &)=delete
CuckooCache::cache< CuckooCache::KeyOnly< uint256 >, SignatureCacheHasher > map_type
bool Get(const uint256 &entry, const bool erase)
void Set(const uint256 &entry)
static constexpr size_t DEFAULT_SIGNATURE_CACHE_BYTES
Precompute sighash midstate to avoid quadratic hashing.