test: fix wrong transaction in GetP2SHSigOpCount assertion
What changed, and why it matters
This is a one-line fix inside a Bitcoin Core unit test. The test was checking the P2SH signature-operation count for the wrong transaction object: it used a transaction that still had its scriptSig, instead of the version where the scriptSig was intentionally removed. The assertion value was also wrong (20 instead of 0). The change only affects test code, not production consensus or networking logic, so it cannot be exploited by users or attackers.
No security action required. Treat as a normal test-quality fix. Reviewers may optionally verify that the updated assertion matches the intended test scenario.
Security signals we found
test-only change
incorrect test assertion corrected
no production consensus code modified
no network or wallet code modified
Evidence from the diff
In src/test/script_p2sh_tests.cpp, the ValidateInputsStandardness test case was asserting GetP2SHSigOpCount(CTransaction(txToNonStd2), coins) == 20U. The preceding test context, however, validates txToNonStd2_no_scriptSig and expects it to be rejected as non-standard because its P2SH redeemScript is missing. The corrected assertion passes txToNonStd2_no_scriptSig and expects 0 P2SH sigops, which is consistent with a missing scriptSig/redeemScript. This is a test-only bug fix; no production code paths are modified.
Changed components
src/test/script_p2sh_tests.cppInspect captured patch +1 / −1
diff --git a/src/test/script_p2sh_tests.cpp b/src/test/script_p2sh_tests.cpp
index f80090aa..fbf3b3f5 100644
--- a/src/test/script_p2sh_tests.cpp
+++ b/src/test/script_p2sh_tests.cpp
@@ -430,7 +430,7 @@ BOOST_AUTO_TEST_CASE(ValidateInputsStandardness)
BOOST_CHECK(txToNonStd2_no_scriptSig_res.IsInvalid());
BOOST_CHECK_EQUAL(txToNonStd2_no_scriptSig_res.GetRejectReason(), "bad-txns-nonstandard-inputs");
BOOST_CHECK_EQUAL(txToNonStd2_no_scriptSig_res.GetDebugMessage(), "input 0 P2SH redeemscript missing");
- BOOST_CHECK_EQUAL(GetP2SHSigOpCount(CTransaction(txToNonStd2), coins), 20U);
+ BOOST_CHECK_EQUAL(GetP2SHSigOpCount(CTransaction(txToNonStd2_no_scriptSig), coins), 0U);
// TxoutType::NONSTANDARD
CMutableTransaction txToNonStd3;
Why this scored 15/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.