@@ -227,8 +227,11 @@ struct TaprootSpendData
227227 /* * The Merkle root of the script tree (0 if no scripts). */
228228 uint256 merkle_root;
229229 /* * Map from (script, leaf_version) to (sets of) control blocks.
230- * The control blocks are sorted by size, so that the signing logic can
231- * easily prefer the cheapest one. */
230+ * More than one control block for a given script is only possible if it
231+ * appears in multiple branches of the tree. We keep them all so that
232+ * inference can reconstruct the full tree. Within each set, the control
233+ * blocks are sorted by size, so that the signing logic can easily
234+ * prefer the cheapest one. */
232235 std::map<std::pair<CScript, int >, std::set<std::vector<unsigned char >, ShortestVectorFirstComparator>> scripts;
233236 /* * Merge other TaprootSpendData (for the same scriptPubKey) into this. */
234237 void Merge (TaprootSpendData other);
@@ -252,7 +255,7 @@ class TaprootBuilder
252255 /* * Merkle hash of this node. */
253256 uint256 hash;
254257 /* * Tracked leaves underneath this node (either from the node itself, or its children).
255- * The merkle_branch field for each is the partners to get to *this* node. */
258+ * The merkle_branch field of each is the partners to get to *this* node. */
256259 std::vector<LeafInfo> leaves;
257260 };
258261 /* * Whether the builder is in a valid state so far. */
0 commit comments