aboutsummaryrefslogtreecommitdiff
path: root/src/script/descriptor.h
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2021-03-01 16:18:59 -0500
committerAndrew Chow <achow101-github@achow101.com>2021-06-24 13:49:22 -0400
commitd87b544b834077f102724415e0fada6ee8b2def2 (patch)
treed477a3f60f8bdc5e326235896fa9a0b12e3c0e6f /src/script/descriptor.h
parentcacc3910989c4f3d7afa530dbab042461426abce (diff)
descriptors: Cache last hardened xpub
Cache the last hardenex xpub in the DescriptorCache
Diffstat (limited to 'src/script/descriptor.h')
-rw-r--r--src/script/descriptor.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/script/descriptor.h b/src/script/descriptor.h
index 7e422332a0..9ec2a766b1 100644
--- a/src/script/descriptor.h
+++ b/src/script/descriptor.h
@@ -22,6 +22,8 @@ private:
std::unordered_map<uint32_t, ExtPubKeyMap> m_derived_xpubs;
/** Map key expression index -> parent xpub */
ExtPubKeyMap m_parent_xpubs;
+ /** Map key expression index -> last hardened xpub */
+ ExtPubKeyMap m_last_hardened_xpubs;
public:
/** Cache a parent xpub
@@ -50,11 +52,25 @@ public:
* @param[in] xpub The CExtPubKey to get from cache
*/
bool GetCachedDerivedExtPubKey(uint32_t key_exp_pos, uint32_t der_index, CExtPubKey& xpub) const;
+ /** Cache a last hardened xpub
+ *
+ * @param[in] key_exp_pos Position of the key expression within the descriptor
+ * @param[in] xpub The CExtPubKey to cache
+ */
+ void CacheLastHardenedExtPubKey(uint32_t key_exp_pos, const CExtPubKey& xpub);
+ /** Retrieve a cached last hardened xpub
+ *
+ * @param[in] key_exp_pos Position of the key expression within the descriptor
+ * @param[in] xpub The CExtPubKey to get from cache
+ */
+ bool GetCachedLastHardenedExtPubKey(uint32_t key_exp_pos, CExtPubKey& xpub) const;
/** Retrieve all cached parent xpubs */
const ExtPubKeyMap GetCachedParentExtPubKeys() const;
/** Retrieve all cached derived xpubs */
const std::unordered_map<uint32_t, ExtPubKeyMap> GetCachedDerivedExtPubKeys() const;
+ /** Retrieve all cached last hardened xpubs */
+ const ExtPubKeyMap GetCachedLastHardenedExtPubKeys() const;
/** Combine another DescriptorCache into this one.
* Returns a cache containing the items from the other cache unknown to current cache