Skip to content

Commit 0848db9

Browse files
committed
fuzz: Remove useless GetUTXOStats fuzz case
In the GetUTXOStats fuzz case, GetUTXOStats is always called with a CCoinsViewCache. Which is guaranteed to throw a std::logic_error when its ::Cursor() method is called on the first line of GetUTXOStats. In the fuzz case, we basically catch this logic error and declare victory if we caught it. There is no point to fuzzing this deterministic logic. Confirmed with IWYU that the node/coinstats.h #include is no longer necessary.
1 parent 52b1939 commit 0848db9

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

src/test/fuzz/coins_view.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <consensus/tx_verify.h>
1111
#include <consensus/validation.h>
1212
#include <key.h>
13-
#include <node/coinstats.h>
1413
#include <policy/policy.h>
1514
#include <primitives/transaction.h>
1615
#include <pubkey.h>
@@ -26,10 +25,6 @@
2625
#include <string>
2726
#include <vector>
2827

29-
using node::CCoinsStats;
30-
using node::CoinStatsHashType;
31-
using node::GetUTXOStats;
32-
3328
namespace {
3429
const TestingSetup* g_setup;
3530
const Coin EMPTY_COIN{};
@@ -269,16 +264,6 @@ FUZZ_TARGET_INIT(coins_view, initialize_coins_view)
269264
}
270265
(void)GetTransactionSigOpCost(transaction, coins_view_cache, flags);
271266
},
272-
[&] {
273-
CCoinsStats stats{CoinStatsHashType::HASH_SERIALIZED};
274-
bool expected_code_path = false;
275-
try {
276-
(void)GetUTXOStats(&coins_view_cache, g_setup->m_node.chainman->m_blockman, stats);
277-
} catch (const std::logic_error&) {
278-
expected_code_path = true;
279-
}
280-
assert(expected_code_path);
281-
},
282267
[&] {
283268
(void)IsWitnessStandard(CTransaction{random_mutable_transaction}, coins_view_cache);
284269
});

0 commit comments

Comments
 (0)