2828#include < optional>
2929#include < string>
3030#include < vector>
31+ #include < logging.h>
3132
3233using util::Split;
3334
@@ -1631,7 +1632,7 @@ class TSHDescriptor final : public DescriptorImpl
16311632 uint256 merkle_root = builder.GetSpendData ().merkle_root ;
16321633
16331634 CScript output_script;
1634- output_script << OP_3 << ToByteVector (merkle_root);
1635+ output_script << OP_2 << ToByteVector (merkle_root);
16351636
16361637 return {output_script};
16371638 }
@@ -2470,7 +2471,6 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index
24702471 }
24712472 }
24722473 assert (TaprootBuilder::ValidDepths (depths));
2473-
24742474 // Make sure all vecs are of the same length, or exactly length 1
24752475 // For length 1 vectors, clone subdescs until vector is the same length
24762476 for (auto & vec : subscripts) {
@@ -2483,7 +2483,6 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index
24832483 return {};
24842484 }
24852485 }
2486-
24872486 if (internal_keys.size () > 1 && internal_keys.size () != max_providers_len) {
24882487 error = strprintf (" tr(): Multipath internal key mismatches multipath subscripts lengths" );
24892488 return {};
@@ -2492,7 +2491,6 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index
24922491 while (internal_keys.size () < max_providers_len) {
24932492 internal_keys.emplace_back (internal_keys.at (0 )->Clone ());
24942493 }
2495-
24962494 // Build the final descriptors vector
24972495 for (size_t i = 0 ; i < max_providers_len; ++i) {
24982496 // Build final subscripts vectors by retrieving the i'th subscript for each vector in subscripts
@@ -2515,7 +2513,6 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index
25152513 // P2TSH only supports script path, no internal key
25162514 std::vector<std::vector<std::unique_ptr<DescriptorImpl>>> subscripts;
25172515 std::vector<int > depths;
2518-
25192516 if (expr.size ()) {
25202517 /* * The path from the top of the tree to what we're currently processing.
25212518 * branches[i] == false: left branch in the i'th step from the top; true: right branch.
@@ -2534,7 +2531,9 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index
25342531 // Process the actual script expression.
25352532 auto sarg = Expr (expr);
25362533 subscripts.emplace_back (ParseScript (key_exp_index, sarg, ParseScriptContext::P2TSH, out, error));
2537- if (subscripts.back ().empty ()) return {};
2534+ if (subscripts.back ().empty ()) {
2535+ return {};
2536+ }
25382537 depths.push_back (branches.size ());
25392538 // Process closing braces; one is expected for every right branch we were in.
25402539 while (branches.size () && branches.back ()) {
@@ -2559,7 +2558,6 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index
25592558 return {};
25602559 }
25612560 }
2562-
25632561 assert (TaprootBuilder::ValidDepths (depths));
25642562
25652563 // Build the final descriptors vector
0 commit comments