fuzz: remove redundant CScript method calls from script harness
What changed, and why it matters
This commit is a minor cleanup of Bitcoin Core's fuzz testing code. It removes duplicate calls to CScript methods from one fuzz harness and adds one missing method call to another harness. There is no change to production code, consensus logic, networking, or wallet behavior, and no security issue is present.
No security action needed. This is a routine test-maintenance change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors fuzz test coverage only. In src/test/fuzz/script.cpp it removes six redundant CScript method calls (HasValidOps, IsPayToAnchor, IsPayToScriptHash, IsPayToWitnessScriptHash, IsPushOnly, GetSigOpCount) because the dedicated script_ops harness already exercises them. In src/test/fuzz/script_ops.cpp it adds the missing IsPayToAnchor call so coverage is preserved. No functional code is modified.
Changed components
src/test/fuzz/script.cppsrc/test/fuzz/script_ops.cppInspect captured patch +1 / −7
diff --git a/src/test/fuzz/script.cpp b/src/test/fuzz/script.cpp
index 8d2d0e2c..0017af38 100644
--- a/src/test/fuzz/script.cpp
+++ b/src/test/fuzz/script.cpp
@@ -93,13 +93,6 @@ FUZZ_TARGET(script, .init = initialize_script)
std::vector<std::vector<unsigned char>> solutions;
(void)Solver(script, solutions);
- (void)script.HasValidOps();
- (void)script.IsPayToAnchor();
- (void)script.IsPayToScriptHash();
- (void)script.IsPayToWitnessScriptHash();
- (void)script.IsPushOnly();
- (void)script.GetSigOpCount(/* fAccurate= */ false);
-
{
const std::vector<uint8_t> bytes = ConsumeRandomLengthByteVector(fuzzed_data_provider);
CompressedScript compressed_script;
diff --git a/src/test/fuzz/script_ops.cpp b/src/test/fuzz/script_ops.cpp
index 2e84038d..5c5f60f2 100644
--- a/src/test/fuzz/script_ops.cpp
+++ b/src/test/fuzz/script_ops.cpp
@@ -48,6 +48,7 @@ FUZZ_TARGET(script_ops)
(void)script.GetSigOpCount(script);
(void)script.HasValidOps();
(void)script.IsPayToScriptHash();
+ (void)script.IsPayToAnchor();
(void)script.IsPayToWitnessScriptHash();
(void)script.IsPushOnly();
(void)script.IsUnspendable();
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.