mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
wallet: accurately account for the size of the witness stack
When estimating the maximum size of an input, we were assuming the number of elements on the witness stack could be encode in a single byte. This is a valid approximation for all the descriptors we support (including P2WSH Miniscript ones), but may not hold anymore once we support Miniscript within Taproot descriptors (since the max standard witness stack size of 100 gets lifted). It's a low-hanging fruit to account for it correctly, so just do it now.
This commit is contained in:
@@ -154,7 +154,8 @@ void DoCheck(std::string prv, std::string pub, const std::string& norm_pub, int
|
||||
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_nonmaxsig{parse_priv->MaxSatisfactionWeight(true)};
|
||||
const bool is_input_size_info_set{max_sat_maxsig && max_sat_nonmaxsig};
|
||||
const auto max_elems{parse_priv->MaxSatisfactionElems()};
|
||||
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);
|
||||
|
||||
// The ScriptSize() must match the size of the Script string. (ScriptSize() is set for all descs but 'combo()'.)
|
||||
|
||||
Reference in New Issue
Block a user