diff options
author | Andrew Chow <achow101-github@achow101.com> | 2020-02-25 16:01:58 -0500 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2020-03-07 10:13:47 -0500 |
commit | 58f54b686f663e4c46a2cf7a64560409007c7eb3 (patch) | |
tree | 51b1604332b9a8f589041a61e06be1df3ce759c7 /src/script/descriptor.h | |
parent | 66c2cadc91d26074b89e5ada68350b5c8676efac (diff) |
Add DescriptorCache* read_cache and DescriptorCache* write_cache to Expand and GetPubKey
Have Expand, ExpandFromCache, and ExpandHelper take additional DescriptorCache
parameters. These are then passed into PubkeyProvider::GetPubKey which
also takes them as arguments.
Reading and writing to the cache is pushed down into GetPubKey. The old cache where
pubkeys are serialized to a vector is completely removed and instead xpubs are being
cached in DescriptorCache.
Diffstat (limited to 'src/script/descriptor.h')
-rw-r--r-- | src/script/descriptor.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/script/descriptor.h b/src/script/descriptor.h index 5c686d68c1..34cd5760de 100644 --- a/src/script/descriptor.h +++ b/src/script/descriptor.h @@ -96,18 +96,18 @@ struct Descriptor { * @param[in] provider The provider to query for private keys in case of hardened derivation. * @param[out] output_scripts The expanded scriptPubKeys. * @param[out] out Scripts and public keys necessary for solving the expanded scriptPubKeys (may be equal to `provider`). - * @param[out] cache Cache data necessary to evaluate the descriptor at this point without access to private keys. + * @param[out] write_cache Cache data necessary to evaluate the descriptor at this point without access to private keys. */ - virtual bool Expand(int pos, const SigningProvider& provider, std::vector<CScript>& output_scripts, FlatSigningProvider& out, std::vector<unsigned char>* cache = nullptr) const = 0; + virtual bool Expand(int pos, const SigningProvider& provider, std::vector<CScript>& output_scripts, FlatSigningProvider& out, DescriptorCache* write_cache = nullptr) const = 0; /** Expand a descriptor at a specified position using cached expansion data. * * @param[in] pos The position at which to expand the descriptor. If IsRange() is false, this is ignored. - * @param[in] cache Cached expansion data. + * @param[in] read_cache Cached expansion data. * @param[out] output_scripts The expanded scriptPubKeys. * @param[out] out Scripts and public keys necessary for solving the expanded scriptPubKeys (may be equal to `provider`). */ - virtual bool ExpandFromCache(int pos, const std::vector<unsigned char>& cache, std::vector<CScript>& output_scripts, FlatSigningProvider& out) const = 0; + virtual bool ExpandFromCache(int pos, const DescriptorCache& read_cache, std::vector<CScript>& output_scripts, FlatSigningProvider& out) const = 0; /** Expand the private key for a descriptor at a specified position, if possible. * |