Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Private Types | Private Attributes | List of all members
SignatureCache Class Reference

Valid signature cache, to avoid doing expensive ECDSA signature checking twice for every transaction (once when accepted into memory pool, and again when accepted into the block chain) More...

#include <sigcache.h>

Collaboration diagram for SignatureCache:
[legend]

Public Member Functions

 SignatureCache (size_t max_size_bytes)
 
 SignatureCache (const SignatureCache &)=delete
 
SignatureCacheoperator= (const SignatureCache &)=delete
 
void ComputeEntryECDSA (uint256 &entry, const uint256 &hash, const std::vector< unsigned char > &vchSig, const CPubKey &pubkey) const
 
void ComputeEntrySchnorr (uint256 &entry, const uint256 &hash, Span< const unsigned char > sig, const XOnlyPubKey &pubkey) const
 
bool Get (const uint256 &entry, const bool erase)
 
void Set (const uint256 &entry)
 

Private Types

typedef CuckooCache::cache< uint256, SignatureCacheHashermap_type
 

Private Attributes

CSHA256 m_salted_hasher_ecdsa
 Entries are SHA256(nonce || 'E' or 'S' || 31 zero bytes || signature hash || public key || signature): More...
 
CSHA256 m_salted_hasher_schnorr
 
map_type setValid
 
std::shared_mutex cs_sigcache
 

Detailed Description

Valid signature cache, to avoid doing expensive ECDSA signature checking twice for every transaction (once when accepted into memory pool, and again when accepted into the block chain)

Definition at line 38 of file sigcache.h.

Member Typedef Documentation

◆ map_type

Definition at line 44 of file sigcache.h.

Constructor & Destructor Documentation

◆ SignatureCache() [1/2]

SignatureCache::SignatureCache ( size_t  max_size_bytes)

Definition at line 20 of file sigcache.cpp.

Here is the call graph for this function:

◆ SignatureCache() [2/2]

SignatureCache::SignatureCache ( const SignatureCache )
delete

Member Function Documentation

◆ ComputeEntryECDSA()

void SignatureCache::ComputeEntryECDSA ( uint256 entry,
const uint256 hash,
const std::vector< unsigned char > &  vchSig,
const CPubKey pubkey 
) const

Definition at line 39 of file sigcache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeEntrySchnorr()

void SignatureCache::ComputeEntrySchnorr ( uint256 entry,
const uint256 hash,
Span< const unsigned char >  sig,
const XOnlyPubKey pubkey 
) const

Definition at line 45 of file sigcache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get()

bool SignatureCache::Get ( const uint256 entry,
const bool  erase 
)

Definition at line 51 of file sigcache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

SignatureCache & SignatureCache::operator= ( const SignatureCache )
delete

◆ Set()

void SignatureCache::Set ( const uint256 entry)

Definition at line 57 of file sigcache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ cs_sigcache

std::shared_mutex SignatureCache::cs_sigcache
private

Definition at line 46 of file sigcache.h.

◆ m_salted_hasher_ecdsa

CSHA256 SignatureCache::m_salted_hasher_ecdsa
private

Entries are SHA256(nonce || 'E' or 'S' || 31 zero bytes || signature hash || public key || signature):

Definition at line 42 of file sigcache.h.

◆ m_salted_hasher_schnorr

CSHA256 SignatureCache::m_salted_hasher_schnorr
private

Definition at line 43 of file sigcache.h.

◆ setValid

map_type SignatureCache::setValid
private

Definition at line 45 of file sigcache.h.


The documentation for this class was generated from the following files: