[#TaprootSpendData]
= TaprootSpendData
:mrdocs:

Data needed to spend a Taproot output, including its script tree&period;

== Synopsis

Declared in `&lt;script&sol;signingprovider&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct TaprootSpendData;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:TaprootSpendData/Merge.adoc[`Merge`] 
| Merge other TaprootSpendData (for the same scriptPubKey) into this&period;
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:TaprootSpendData/internal_key.adoc[`internal&lowbar;key`] 
| The BIP341 internal key&period;
| xref:TaprootSpendData/merkle_root.adoc[`merkle&lowbar;root`] 
| The Merkle root of the script tree (0 if no scripts)&period;
| xref:TaprootSpendData/scripts.adoc[`scripts`] 
| Map from (script, leaf&lowbar;version) to (sets of) control blocks&period; More than one control block for a given script is only possible if it appears in multiple branches of the tree&period; We keep them all so that inference can reconstruct the full tree&period; Within each set, the control blocks are sorted by size, so that the signing logic can easily prefer the cheapest one&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:InferTaprootTree.adoc[`InferTaprootTree`]
| Given a TaprootSpendData and the output key, reconstruct its script tree&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
