sign: Remove duplicate sigversion check
What changed, and why it matters
This commit removes an internal safety assertion in Bitcoin Core's transaction signing code and tweaks a comment. The removed assertion checked that Schnorr signatures were only created for the intended Taproot/Tapscript contexts. The change appears to be a minor cleanup because the same check is performed elsewhere, but removing a defensive assertion slightly reduces code safety margin. There is no direct evidence this introduces a real vulnerability.
No immediate action required. Reviewers may verify that all call sites of CreateSchnorrSig enforce the Taproot/Tapscript SigVersion invariant, since the removed assertion no longer catches violations at this layer.
Security signals we found
Removal of a defensive assertion in a cryptographic signing function
Assertion guarded against invalid SigVersion reaching Schnorr signing path
No functional code change beyond assertion removal and comment update
Change is small and appears to be code cleanup
Evidence from the diff
In src/script/sign.cpp, the commit deletes assert(sigversion == SigVersion::TAPROOT || sigversion == SigVersion::TAPSCRIPT); from MutableTransactionSignatureCreator::CreateSchnorrSig. It also updates a comment in SignMuSig2 to clarify loop behavior. The assertion was a duplicate guard; callers already validate sigversion before invoking this path. The change does not alter functional logic or signature output.
Changed components
src/script/sign.cppMutableTransactionSignatureCreator::CreateSchnorrSigSignMuSig2Inspect captured patch +1 / −3
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index 8103e318..7f9a2214 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -87,8 +87,6 @@ std::optional<uint256> MutableTransactionSignatureCreator::ComputeSchnorrSignatu
bool MutableTransactionSignatureCreator::CreateSchnorrSig(const SigningProvider& provider, std::vector<unsigned char>& sig, const XOnlyPubKey& pubkey, const uint256* leaf_hash, const uint256* merkle_root, SigVersion sigversion) const
{
- assert(sigversion == SigVersion::TAPROOT || sigversion == SigVersion::TAPSCRIPT);
-
CKey key;
if (!provider.GetKeyByXOnly(pubkey, key)) return false;
@@ -342,7 +340,7 @@ static bool SignMuSig2(const BaseSignatureCreator& creator, SignatureData& sigda
sigdata.musig2_partial_sigs[pub_key_leaf_hash].emplace(part_pk, partial_sig);
}
}
- // If there are any partial signatures, exit early
+ // If there are any partial signatures, continue with next aggregate pubkey
auto partial_sigs_it = sigdata.musig2_partial_sigs.find(pub_key_leaf_hash);
if (partial_sigs_it != sigdata.musig2_partial_sigs.end() && !partial_sigs_it->second.empty()) {
continue;
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.