@@ -77,6 +77,7 @@ struct TestData {
77
77
sig.push_back (1 ); // sighash byte
78
78
signatures.emplace (pubkey, sig);
79
79
BOOST_CHECK (key.SignSchnorr (MESSAGE_HASH, schnorr_sig, nullptr , EMPTY_AUX));
80
+ schnorr_sig.push_back (1 ); // Maximally sized Schnorr sigs have a sighash byte.
80
81
schnorr_signatures.emplace (XOnlyPubKey{pubkey}, schnorr_sig);
81
82
82
83
// Compute various hashes
@@ -367,6 +368,8 @@ void TestSatisfy(const KeyConverter& converter, const std::string& testcase, con
367
368
// Run non-malleable satisfaction algorithm.
368
369
CScriptWitness witness_nonmal;
369
370
const bool nonmal_success = node->Satisfy (satisfier, witness_nonmal.stack , true ) == miniscript::Availability::YES;
371
+ // Compute witness size (excluding script push, control block, and witness count encoding).
372
+ const size_t wit_size = GetSerializeSize (witness_nonmal.stack , PROTOCOL_VERSION) - GetSizeOfCompactSize (witness_nonmal.stack .size ());
370
373
SatisfactionToWitness (converter.MsContext (), witness_nonmal, script, builder);
371
374
372
375
if (nonmal_success) {
@@ -378,6 +381,7 @@ void TestSatisfy(const KeyConverter& converter, const std::string& testcase, con
378
381
// If a non-malleable satisfaction exists, the malleable one must also exist, and be identical to it.
379
382
BOOST_CHECK (mal_success);
380
383
BOOST_CHECK (witness_nonmal.stack == witness_mal.stack );
384
+ assert (wit_size <= *node->GetWitnessSize ());
381
385
382
386
// Test non-malleable satisfaction.
383
387
ScriptError serror;
0 commit comments