What changed, and why it matters
This commit fixes a test case in Bitcoin Core's own test suite. It changes a P2PK (pay-to-pubkey) script test so that it actually enables the P2SH validation flag it claims to be testing. The bug was only in the test data and test code, not in the production Bitcoin consensus or networking code. There is no change to how real Bitcoin transactions are validated.
No security action required. Treat as a normal test-quality fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch corrects two related mistakes in src/test/data/script_tests.json and src/test/script_tests.cpp. A test named ‘P2PK with non-push scriptSig but with P2SH validation’ was not actually passing the SCRIPT_VERIFY_P2SH flag. The C++ test builder used flags=0, and the JSON test vector had an empty flags string. The commit sets the flag to SCRIPT_VERIFY_P2SH in the C++ builder and to ‘P2SH’ in the JSON vector, aligning the test with its intended purpose. No consensus, policy, or P2P code is modified.
Changed components
src/test/data/script_tests.jsonsrc/test/script_tests.cppInspect captured patch +2 / −2
diff --git a/src/test/data/script_tests.json b/src/test/data/script_tests.json
index 1af22938..2b7f5042 100644
--- a/src/test/data/script_tests.json
+++ b/src/test/data/script_tests.json
@@ -1826,7 +1826,7 @@
[
"0x47 0x304402203e4516da7253cf068effec6b95c41221c0cf3a8e6ccb8cbf1725b562e9afde2c022054e1c258c2981cdfba5df1f46661fb6541c44f77ca0092f3600331abfffb125101 NOP8",
"0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 CHECKSIG",
- "",
+ "P2SH",
"OK",
"P2PK with non-push scriptSig but with P2SH validation"
],
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp
index 58958850..96f1cb1f 100644
--- a/src/test/script_tests.cpp
+++ b/src/test/script_tests.cpp
@@ -667,7 +667,7 @@ BOOST_AUTO_TEST_CASE(script_build)
"P2SH(P2PK) with non-push scriptSig but no P2SH or SIGPUSHONLY", 0, true
).PushSig(keys.key2).Opcode(OP_NOP8).PushRedeem());
tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey2C) << OP_CHECKSIG,
- "P2PK with non-push scriptSig but with P2SH validation", 0
+ "P2PK with non-push scriptSig but with P2SH validation", SCRIPT_VERIFY_P2SH
).PushSig(keys.key2).Opcode(OP_NOP8));
tests.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey2C) << OP_CHECKSIG,
"P2SH(P2PK) with non-push scriptSig but no SIGPUSHONLY", SCRIPT_VERIFY_P2SH, true
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.