mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 16:03:15 +02:00
fuzz: move the coins_view target's body into a standalone function
We'll reuse it for a target where the coins view is a DB.
This commit is contained in:
committed by
marcofleon
parent
56d878c465
commit
46e14630f7
@@ -14,6 +14,7 @@
|
||||
#include <test/fuzz/fuzz.h>
|
||||
#include <test/fuzz/util.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <txdb.h>
|
||||
#include <util/hasher.h>
|
||||
|
||||
#include <cassert>
|
||||
@@ -41,12 +42,10 @@ void initialize_coins_view()
|
||||
static const auto testing_setup = MakeNoLogFileContext<>();
|
||||
}
|
||||
|
||||
FUZZ_TARGET(coins_view, .init = initialize_coins_view)
|
||||
void TestCoinsView(FuzzedDataProvider& fuzzed_data_provider, CCoinsView& backend_coins_view)
|
||||
{
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
bool good_data{true};
|
||||
|
||||
CCoinsView backend_coins_view;
|
||||
CCoinsViewCache coins_view_cache{&backend_coins_view, /*deterministic=*/true};
|
||||
COutPoint random_out_point;
|
||||
Coin random_coin;
|
||||
@@ -294,3 +293,10 @@ FUZZ_TARGET(coins_view, .init = initialize_coins_view)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
FUZZ_TARGET(coins_view, .init = initialize_coins_view)
|
||||
{
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
CCoinsView backend_coins_view;
|
||||
TestCoinsView(fuzzed_data_provider, backend_coins_view);
|
||||
}
|
||||
|
Reference in New Issue
Block a user