Merge bitcoin/bitcoin#31570: test: descriptor: fix test for MaxSatisfactionWeight

b29d68f942 test: descriptor: fix test for `MaxSatisfactionWeight` (brunoerg)

Pull request description:

  To get the maximum size of a satisfaction for a descriptor with no max sig, the parameter `use_max_sig` should be false.

ACKs for top commit:
  fjahr:
    utACK b29d68f942
  achow101:
    ACK b29d68f942
  tdb3:
    re ACK b29d68f942
  furszy:
    utACK b29d68f942

Tree-SHA512: 8559718d126e60ce21a34183f74d227546108b43e3897e49622d6677ed9e7707caa962fd811d8787bd4dafc48a0e779ef11050d5990293faa2f91ded4aaa4f4b
This commit is contained in:
Ava Chow 2024-12-30 15:04:51 -05:00
commit 9b9752217f
No known key found for this signature in database
GPG key ID: 17565732E08E5E41

View file

@ -161,7 +161,8 @@ void DoCheck(std::string prv, std::string pub, const std::string& norm_pub, int
// We must be able to estimate the max satisfaction size for any solvable descriptor top descriptor (but combo). // We must be able to estimate the max satisfaction size for any solvable descriptor top descriptor (but combo).
const bool is_nontop_or_nonsolvable{!parse_priv->IsSolvable() || !parse_priv->GetOutputType()}; const bool is_nontop_or_nonsolvable{!parse_priv->IsSolvable() || !parse_priv->GetOutputType()};
const auto max_sat_maxsig{parse_priv->MaxSatisfactionWeight(true)}; const auto max_sat_maxsig{parse_priv->MaxSatisfactionWeight(true)};
const auto max_sat_nonmaxsig{parse_priv->MaxSatisfactionWeight(true)}; const auto max_sat_nonmaxsig{parse_priv->MaxSatisfactionWeight(false)};
BOOST_CHECK(max_sat_nonmaxsig <= max_sat_maxsig);
const auto max_elems{parse_priv->MaxSatisfactionElems()}; const auto max_elems{parse_priv->MaxSatisfactionElems()};
const bool is_input_size_info_set{max_sat_maxsig && max_sat_nonmaxsig && max_elems}; const bool is_input_size_info_set{max_sat_maxsig && max_sat_nonmaxsig && max_elems};
BOOST_CHECK_MESSAGE(is_input_size_info_set || is_nontop_or_nonsolvable, prv); BOOST_CHECK_MESSAGE(is_input_size_info_set || is_nontop_or_nonsolvable, prv);