mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-12 10:30:08 +01: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:
parent
16aaad3c1d
commit
85b9b8dfd0
1 changed files with 9 additions and 3 deletions
|
@ -14,6 +14,7 @@
|
||||||
#include <test/fuzz/fuzz.h>
|
#include <test/fuzz/fuzz.h>
|
||||||
#include <test/fuzz/util.h>
|
#include <test/fuzz/util.h>
|
||||||
#include <test/util/setup_common.h>
|
#include <test/util/setup_common.h>
|
||||||
|
#include <txdb.h>
|
||||||
#include <util/hasher.h>
|
#include <util/hasher.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -41,12 +42,10 @@ void initialize_coins_view()
|
||||||
static const auto testing_setup = MakeNoLogFileContext<>();
|
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};
|
bool good_data{true};
|
||||||
|
|
||||||
CCoinsView backend_coins_view;
|
|
||||||
CCoinsViewCache coins_view_cache{&backend_coins_view, /*deterministic=*/true};
|
CCoinsViewCache coins_view_cache{&backend_coins_view, /*deterministic=*/true};
|
||||||
COutPoint random_out_point;
|
COutPoint random_out_point;
|
||||||
Coin random_coin;
|
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);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue