aboutsummaryrefslogtreecommitdiff
path: root/src/script/descriptor.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-11-02 19:19:39 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-11-28 15:24:49 -0800
commit82df4c64ffa2f0dd45e7ae694903615358f121a6 (patch)
tree942cc9dcb23e0004660d129358fd8afed6ba2467 /src/script/descriptor.h
parent1eda33aabc15b905a1e23ffab648ecf2a8f5322b (diff)
Add descriptor expansion cache
Diffstat (limited to 'src/script/descriptor.h')
-rw-r--r--src/script/descriptor.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/script/descriptor.h b/src/script/descriptor.h
index 0111972f85..44f0efca03 100644
--- a/src/script/descriptor.h
+++ b/src/script/descriptor.h
@@ -48,8 +48,18 @@ struct Descriptor {
* provider: the provider to query for private keys in case of hardened derivation.
* output_script: the expanded scriptPubKeys will be put here.
* out: scripts and public keys necessary for solving the expanded scriptPubKeys will be put here (may be equal to provider).
+ * cache: vector which will be overwritten with 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) const = 0;
+ virtual bool Expand(int pos, const SigningProvider& provider, std::vector<CScript>& output_scripts, FlatSigningProvider& out, std::vector<unsigned char>* cache = nullptr) const = 0;
+
+ /** Expand a descriptor at a specified position using cached expansion data.
+ *
+ * pos: the position at which to expand the descriptor. If IsRange() is false, this is ignored.
+ * cache: vector from which cached expansion data will be read.
+ * output_script: the expanded scriptPubKeys will be put here.
+ * out: scripts and public keys necessary for solving the expanded scriptPubKeys will be put here (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;
};
/** Parse a descriptor string. Included private keys are put in out. Returns nullptr if parsing fails. */