fuzz: compact coins view db during fuzzing
What changed, and why it matters
This commit only adds a new test operation to an existing fuzzing target. It exercises a database compaction function (CompactFullAsync) during automated fuzz testing, with no changes to production code or user-facing behavior. There is no indication of a security fix or vulnerability.
No security action needed. Treat as routine test/fuzzing improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change modifies src/test/fuzz/coins_view.cpp to add a fuzz operation that calls CCoinsViewDB::CompactFullAsync() under the cs_main lock when the backend is a CCoinsViewDB. This is purely test coverage for concurrent compaction behavior. No production code paths are altered.
Changed components
src/test/fuzz/coins_view.cppInspect captured patch +6 / −1
diff --git a/src/test/fuzz/coins_view.cpp b/src/test/fuzz/coins_view.cpp
index c11581d2..db81e190 100644
--- a/src/test/fuzz/coins_view.cpp
+++ b/src/test/fuzz/coins_view.cpp
@@ -7,6 +7,7 @@
#include <consensus/tx_check.h>
#include <consensus/tx_verify.h>
#include <consensus/validation.h>
+#include <kernel/cs_main.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/interpreter.h>
@@ -92,7 +93,8 @@ void initialize_coins_view()
void TestCoinsView(FuzzedDataProvider& fuzzed_data_provider, CCoinsViewCache& coins_view_cache, CCoinsView* backend_coins_view)
{
- const bool is_db{dynamic_cast<CCoinsViewDB*>(backend_coins_view) != nullptr};
+ auto* const db{dynamic_cast<CCoinsViewDB*>(backend_coins_view)};
+ const bool is_db{db != nullptr};
bool good_data{true};
auto* original_backend{backend_coins_view};
@@ -124,6 +126,9 @@ void TestCoinsView(FuzzedDataProvider& fuzzed_data_provider, CCoinsViewCache& co
[&] {
coins_view_cache.Sync();
},
+ [&] {
+ if (db) WITH_LOCK(::cs_main, (void)db->CompactFullAsync());
+ },
[&] {
uint256 best_block{ConsumeUInt256(fuzzed_data_provider)};
// `CCoinsViewDB::BatchWrite()` requires a non-null best block.
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.