11
11
12
12
#include < vector>
13
13
14
- // Descriptors are strings that describe a set of scriptPubKeys, together with
15
- // all information necessary to solve them. By combining all information into
16
- // one, they avoid the need to separately import keys and scripts.
17
- //
18
- // Descriptors may be ranged, which occurs when the public keys inside are
19
- // specified in the form of HD chains (xpubs).
20
- //
21
- // Descriptors always represent public information - public keys and scripts -
22
- // but in cases where private keys need to be conveyed along with a descriptor,
23
- // they can be included inside by changing public keys to private keys (WIF
24
- // format), and changing xpubs by xprvs.
25
- //
26
- // Reference documentation about the descriptor language can be found in
27
- // doc/descriptors.md.
28
-
29
- /* * Interface for parsed descriptor objects. */
14
+
15
+ /* * \brief Interface for parsed descriptor objects.
16
+ *
17
+ * Descriptors are strings that describe a set of scriptPubKeys, together with
18
+ * all information necessary to solve them. By combining all information into
19
+ * one, they avoid the need to separately import keys and scripts.
20
+ *
21
+ * Descriptors may be ranged, which occurs when the public keys inside are
22
+ * specified in the form of HD chains (xpubs).
23
+ *
24
+ * Descriptors always represent public information - public keys and scripts -
25
+ * but in cases where private keys need to be conveyed along with a descriptor,
26
+ * they can be included inside by changing public keys to private keys (WIF
27
+ * format), and changing xpubs by xprvs.
28
+ *
29
+ * Reference documentation about the descriptor language can be found in
30
+ * doc/descriptors.md.
31
+ */
30
32
struct Descriptor {
31
33
virtual ~Descriptor () = default ;
32
34
@@ -45,51 +47,51 @@ struct Descriptor {
45
47
46
48
/* * Expand a descriptor at a specified position.
47
49
*
48
- * pos: the position at which to expand the descriptor. If IsRange() is false, this is ignored.
49
- * provider: the provider to query for private keys in case of hardened derivation.
50
- * output_scripts: the expanded scriptPubKeys will be put here .
51
- * out: scripts and public keys necessary for solving the expanded scriptPubKeys will be put here (may be equal to provider).
52
- * cache: vector which will be overwritten with cache data necessary to evaluate the descriptor at this point without access to private keys.
50
+ * @param[in] pos: The position at which to expand the descriptor. If IsRange() is false, this is ignored.
51
+ * @param[in] provider: The provider to query for private keys in case of hardened derivation.
52
+ * @param[out] output_scripts: The expanded scriptPubKeys.
53
+ * @param[ out] out: Scripts and public keys necessary for solving the expanded scriptPubKeys (may be equal to ` provider` ).
54
+ * @param[out] cache: Cache data necessary to evaluate the descriptor at this point without access to private keys.
53
55
*/
54
56
virtual bool Expand (int pos, const SigningProvider& provider, std::vector<CScript>& output_scripts, FlatSigningProvider& out, std::vector<unsigned char >* cache = nullptr ) const = 0;
55
57
56
58
/* * Expand a descriptor at a specified position using cached expansion data.
57
59
*
58
- * pos: the position at which to expand the descriptor. If IsRange() is false, this is ignored.
59
- * cache: vector from which cached expansion data will be read .
60
- * output_scripts: the expanded scriptPubKeys will be put here .
61
- * out: scripts and public keys necessary for solving the expanded scriptPubKeys will be put here (may be equal to provider).
60
+ * @param[in] pos: The position at which to expand the descriptor. If IsRange() is false, this is ignored.
61
+ * @param[in] cache: Cached expansion data.
62
+ * @param[out] output_scripts: The expanded scriptPubKeys.
63
+ * @param[ out] out: Scripts and public keys necessary for solving the expanded scriptPubKeys (may be equal to ` provider` ).
62
64
*/
63
65
virtual bool ExpandFromCache (int pos, const std::vector<unsigned char >& cache, std::vector<CScript>& output_scripts, FlatSigningProvider& out) const = 0;
64
66
65
67
/* * Expand the private key for a descriptor at a specified position, if possible.
66
68
*
67
- * pos: the position at which to expand the descriptor. If IsRange() is false, this is ignored.
68
- * provider: the provider to query for the private keys.
69
- * out: any private keys available for the specified pos will be placed here .
69
+ * @param[in] pos: The position at which to expand the descriptor. If IsRange() is false, this is ignored.
70
+ * @param[in] provider: The provider to query for the private keys.
71
+ * @param[ out] out: Any private keys available for the specified ` pos` .
70
72
*/
71
73
virtual void ExpandPrivate (int pos, const SigningProvider& provider, FlatSigningProvider& out) const = 0;
72
74
};
73
75
74
- /* * Parse a descriptor string. Included private keys are put in out.
76
+ /* * Parse a ` descriptor` string. Included private keys are put in ` out` .
75
77
*
76
- * If the descriptor has a checksum, it must be valid. If require_checksum
78
+ * If the descriptor has a checksum, it must be valid. If ` require_checksum`
77
79
* is set, the checksum is mandatory - otherwise it is optional.
78
80
*
79
81
* If a parse error occurs, or the checksum is missing/invalid, or anything
80
- * else is wrong, nullptr is returned.
82
+ * else is wrong, ` nullptr` is returned.
81
83
*/
82
84
std::unique_ptr<Descriptor> Parse (const std::string& descriptor, FlatSigningProvider& out, std::string& error, bool require_checksum = false );
83
85
84
- /* * Get the checksum for a descriptor.
86
+ /* * Get the checksum for a ` descriptor` .
85
87
*
86
- * If it already has one, and it is correct, return the checksum in the input.
87
- * If it already has one that is wrong, return "".
88
- * If it does not already have one, return the checksum that would need to be added.
88
+ * - If it already has one, and it is correct, return the checksum in the input.
89
+ * - If it already has one that is wrong, return "".
90
+ * - If it does not already have one, return the checksum that would need to be added.
89
91
*/
90
92
std::string GetDescriptorChecksum (const std::string& descriptor);
91
93
92
- /* * Find a descriptor for the specified script, using information from provider where possible.
94
+ /* * Find a descriptor for the specified ` script` , using information from ` provider` where possible.
93
95
*
94
96
* A non-ranged descriptor which only generates the specified script will be returned in all
95
97
* circumstances.
@@ -98,9 +100,9 @@ std::string GetDescriptorChecksum(const std::string& descriptor);
98
100
* descriptor.
99
101
*
100
102
* - If all information for solving `script` is present in `provider`, a descriptor will be returned
101
- * which is ` IsSolvable()` and encapsulates said information.
103
+ * which is IsSolvable() and encapsulates said information.
102
104
* - Failing that, if `script` corresponds to a known address type, an "addr()" descriptor will be
103
- * returned (which is not ` IsSolvable()` ).
105
+ * returned (which is not IsSolvable()).
104
106
* - Failing that, a "raw()" descriptor is returned.
105
107
*/
106
108
std::unique_ptr<Descriptor> InferDescriptor (const CScript& script, const SigningProvider& provider);
0 commit comments