Bitcoin Core  27.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
DescriptorCache Class Reference

Cache for single descriptor's derived extended pubkeys. More...

#include <descriptor.h>

Public Member Functions

void CacheParentExtPubKey (uint32_t key_exp_pos, const CExtPubKey &xpub)
 Cache a parent xpub. More...
 
bool GetCachedParentExtPubKey (uint32_t key_exp_pos, CExtPubKey &xpub) const
 Retrieve a cached parent xpub. More...
 
void CacheDerivedExtPubKey (uint32_t key_exp_pos, uint32_t der_index, const CExtPubKey &xpub)
 Cache an xpub derived at an index. More...
 
bool GetCachedDerivedExtPubKey (uint32_t key_exp_pos, uint32_t der_index, CExtPubKey &xpub) const
 Retrieve a cached xpub derived at an index. More...
 
void CacheLastHardenedExtPubKey (uint32_t key_exp_pos, const CExtPubKey &xpub)
 Cache a last hardened xpub. More...
 
bool GetCachedLastHardenedExtPubKey (uint32_t key_exp_pos, CExtPubKey &xpub) const
 Retrieve a cached last hardened xpub. More...
 
ExtPubKeyMap GetCachedParentExtPubKeys () const
 Retrieve all cached parent xpubs. More...
 
std::unordered_map< uint32_t, ExtPubKeyMapGetCachedDerivedExtPubKeys () const
 Retrieve all cached derived xpubs. More...
 
ExtPubKeyMap GetCachedLastHardenedExtPubKeys () const
 Retrieve all cached last hardened xpubs. More...
 
DescriptorCache MergeAndDiff (const DescriptorCache &other)
 Combine another DescriptorCache into this one. More...
 

Private Attributes

std::unordered_map< uint32_t, ExtPubKeyMapm_derived_xpubs
 Map key expression index -> map of (key derivation index -> xpub) More...
 
ExtPubKeyMap m_parent_xpubs
 Map key expression index -> parent xpub. More...
 
ExtPubKeyMap m_last_hardened_xpubs
 Map key expression index -> last hardened xpub. More...
 

Detailed Description

Cache for single descriptor's derived extended pubkeys.

Definition at line 19 of file descriptor.h.

Member Function Documentation

◆ CacheDerivedExtPubKey()

void DescriptorCache::CacheDerivedExtPubKey ( uint32_t  key_exp_pos,
uint32_t  der_index,
const CExtPubKey xpub 
)

Cache an xpub derived at an index.

Parameters
[in]key_exp_posPosition of the key expression within the descriptor
[in]der_indexDerivation index of the xpub
[in]xpubThe CExtPubKey to cache

Definition at line 2060 of file descriptor.cpp.

Here is the caller graph for this function:

◆ CacheLastHardenedExtPubKey()

void DescriptorCache::CacheLastHardenedExtPubKey ( uint32_t  key_exp_pos,
const CExtPubKey xpub 
)

Cache a last hardened xpub.

Parameters
[in]key_exp_posPosition of the key expression within the descriptor
[in]xpubThe CExtPubKey to cache

Definition at line 2066 of file descriptor.cpp.

Here is the caller graph for this function:

◆ CacheParentExtPubKey()

void DescriptorCache::CacheParentExtPubKey ( uint32_t  key_exp_pos,
const CExtPubKey xpub 
)

Cache a parent xpub.

Parameters
[in]key_exp_posPosition of the key expression within the descriptor
[in]xpubThe CExtPubKey to cache

Definition at line 2055 of file descriptor.cpp.

Here is the caller graph for this function:

◆ GetCachedDerivedExtPubKey()

bool DescriptorCache::GetCachedDerivedExtPubKey ( uint32_t  key_exp_pos,
uint32_t  der_index,
CExtPubKey xpub 
) const

Retrieve a cached xpub derived at an index.

Parameters
[in]key_exp_posPosition of the key expression within the descriptor
[in]der_indexDerivation index of the xpub
[out]xpubThe CExtPubKey to get from cache

Definition at line 2079 of file descriptor.cpp.

Here is the caller graph for this function:

◆ GetCachedDerivedExtPubKeys()

std::unordered_map< uint32_t, ExtPubKeyMap > DescriptorCache::GetCachedDerivedExtPubKeys ( ) const

Retrieve all cached derived xpubs.

Definition at line 2143 of file descriptor.cpp.

Here is the caller graph for this function:

◆ GetCachedLastHardenedExtPubKey()

bool DescriptorCache::GetCachedLastHardenedExtPubKey ( uint32_t  key_exp_pos,
CExtPubKey xpub 
) const

Retrieve a cached last hardened xpub.

Parameters
[in]key_exp_posPosition of the key expression within the descriptor
[out]xpubThe CExtPubKey to get from cache

Definition at line 2089 of file descriptor.cpp.

Here is the caller graph for this function:

◆ GetCachedLastHardenedExtPubKeys()

ExtPubKeyMap DescriptorCache::GetCachedLastHardenedExtPubKeys ( ) const

Retrieve all cached last hardened xpubs.

Definition at line 2148 of file descriptor.cpp.

Here is the caller graph for this function:

◆ GetCachedParentExtPubKey()

bool DescriptorCache::GetCachedParentExtPubKey ( uint32_t  key_exp_pos,
CExtPubKey xpub 
) const

Retrieve a cached parent xpub.

Parameters
[in]key_exp_posPosition of the key expression within the descriptor
[out]xpubThe CExtPubKey to get from cache

Definition at line 2071 of file descriptor.cpp.

Here is the caller graph for this function:

◆ GetCachedParentExtPubKeys()

ExtPubKeyMap DescriptorCache::GetCachedParentExtPubKeys ( ) const

Retrieve all cached parent xpubs.

Definition at line 2138 of file descriptor.cpp.

Here is the caller graph for this function:

◆ MergeAndDiff()

DescriptorCache DescriptorCache::MergeAndDiff ( const DescriptorCache other)

Combine another DescriptorCache into this one.

Returns a cache containing the items from the other cache unknown to current cache

Definition at line 2097 of file descriptor.cpp.

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

Member Data Documentation

◆ m_derived_xpubs

std::unordered_map<uint32_t, ExtPubKeyMap> DescriptorCache::m_derived_xpubs
private

Map key expression index -> map of (key derivation index -> xpub)

Definition at line 22 of file descriptor.h.

◆ m_last_hardened_xpubs

ExtPubKeyMap DescriptorCache::m_last_hardened_xpubs
private

Map key expression index -> last hardened xpub.

Definition at line 26 of file descriptor.h.

◆ m_parent_xpubs

ExtPubKeyMap DescriptorCache::m_parent_xpubs
private

Map key expression index -> parent xpub.

Definition at line 24 of file descriptor.h.


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