Summary
- Replace
MuSig2SecNonce::IsValid()withHasNonce(), set only after a successfulCreateMuSig2Nonceand cleared byInvalidate(). - Reject
CreateMuSig2PartialSigwhen the secnonce was never generated, and guard the signing provider path inMutableTransactionSignatureCreator::CreateMuSig2PartialSig. - Document the intended signing API on
MuSig2SecNonceand add a unit test.
Previously IsValid() only checked that secure memory was allocated, not that nonce generation succeeded. A caller could reach partial signing with an uninitialized secnonce.
Test plan
build/bin/test_bitcoin --run_test=bip328_testsbuild/bin/test_bitcoin --run_test=psbt_tests(unchanged behavior, sanity)- Manual MuSig2 PSBT signing flow still works end-to-end