Taproot descriptor inference

This commit is contained in:
Pieter Wuille
2021-06-04 15:06:16 -07:00
parent c7388e5ada
commit d637a9b397
4 changed files with 237 additions and 9 deletions

View File

@@ -327,4 +327,12 @@ public:
TaprootSpendData GetSpendData() const;
};
/** Given a TaprootSpendData and the output key, reconstruct its script tree.
*
* If the output doesn't match the spenddata, or if the data in spenddata is incomplete,
* std::nullopt is returned. Otherwise, a vector of (depth, script, leaf_ver) tuples is
* returned, corresponding to a depth-first traversal of the script tree.
*/
std::optional<std::vector<std::tuple<int, CScript, int>>> InferTaprootTree(const TaprootSpendData& spenddata, const XOnlyPubKey& output);
#endif // BITCOIN_SCRIPT_STANDARD_H