mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
refactor: remove dead code in CountWitnessSigOps
Found while reviewing #32840 The `nullptr` witness path was dead in normal code paths: removing it deletes unreachable logic. Code coverage proof: https://maflcko.github.io/b-c-cov/total.coverage/src/script/interpreter.cpp.gcov.html#L2135
This commit is contained in:
@@ -283,7 +283,7 @@ void TestCoinsView(FuzzedDataProvider& fuzzed_data_provider, CCoinsView& backend
|
||||
const auto flags = script_verify_flags::from_int(fuzzed_data_provider.ConsumeIntegral<script_verify_flags::value_type>());
|
||||
if (!transaction.vin.empty() && (flags & SCRIPT_VERIFY_WITNESS) != 0 && (flags & SCRIPT_VERIFY_P2SH) == 0) {
|
||||
// Avoid:
|
||||
// script/interpreter.cpp:1705: size_t CountWitnessSigOps(const CScript &, const CScript &, const CScriptWitness *, unsigned int): Assertion `(flags & SCRIPT_VERIFY_P2SH) != 0' failed.
|
||||
// script/interpreter.cpp:1705: size_t CountWitnessSigOps(const CScript &, const CScript &, const CScriptWitness &, unsigned int): Assertion `(flags & SCRIPT_VERIFY_P2SH) != 0' failed.
|
||||
return;
|
||||
}
|
||||
(void)GetTransactionSigOpCost(transaction, coins_view_cache, flags);
|
||||
|
||||
@@ -125,7 +125,7 @@ FUZZ_TARGET(script, .init = initialize_script)
|
||||
for (const auto& s : random_string_vector) {
|
||||
wit.stack.emplace_back(s.begin(), s.end());
|
||||
}
|
||||
(void)CountWitnessSigOps(script, *other_script, &wit, flags);
|
||||
(void)CountWitnessSigOps(script, *other_script, wit, flags);
|
||||
wit.SetNull();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user