Given a TaprootSpendData and the output key, reconstruct its script tree.
Declared in <script/signingprovider.h>
std::optional<std::vector<std::tuple<int, std::vector<unsigned char>, int>>>
InferTaprootTree(
TaprootSpendData const& spenddata,
XOnlyPubKey const& output);
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.
The reconstructed (depth, script, leaf version) tuples, or std::nullopt on mismatch.
| Name | Description |
|---|---|
| spenddata | The spend data describing the output's scripts. |
| output | The output key the tree must match. |