aboutsummaryrefslogtreecommitdiff
path: root/src/script/descriptor.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-10-12 18:22:22 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-10-26 10:21:05 -0700
commit4d78bd93b5bdf886e743022e80f4edb8a982cf0d (patch)
treeea0b49240ffaca4a5ca1dd1cbbbdd1f157301c13 /src/script/descriptor.h
parentf4e4ea1ceecfb978584bd4f43cb6826e44ba86a3 (diff)
Add support for inferring descriptors from scripts
Diffstat (limited to 'src/script/descriptor.h')
-rw-r--r--src/script/descriptor.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/script/descriptor.h b/src/script/descriptor.h
index 87e07369c7..e44a6ef3c3 100644
--- a/src/script/descriptor.h
+++ b/src/script/descriptor.h
@@ -51,5 +51,20 @@ struct Descriptor {
/** Parse a descriptor string. Included private keys are put in out. Returns nullptr if parsing fails. */
std::unique_ptr<Descriptor> Parse(const std::string& descriptor, FlatSigningProvider& out);
-#endif // BITCOIN_SCRIPT_DESCRIPTOR_H
+/** Find a descriptor for the specified script, using information from provider where possible.
+ *
+ * A non-ranged descriptor which only generates the specified script will be returned in all
+ * circumstances.
+ *
+ * For public keys with key origin information, this information will be preserved in the returned
+ * descriptor.
+ *
+ * - If all information for solving `script` is present in `provider`, a descriptor will be returned
+ * which is `IsSolvable()` and encapsulates said information.
+ * - Failing that, if `script` corresponds to a known address type, an "addr()" descriptor will be
+ * returned (which is not `IsSolvable()`).
+ * - Failing that, a "raw()" descriptor is returned.
+ */
+std::unique_ptr<Descriptor> InferDescriptor(const CScript& script, const SigningProvider& provider);
+#endif // BITCOIN_SCRIPT_DESCRIPTOR_H