|
1 |
| -// Copyright (c) 2022 The Bitcoin Core developers |
| 1 | +// Copyright (c) 2022-present The Bitcoin Core developers |
2 | 2 | // Distributed under the MIT software license, see the accompanying
|
3 | 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
4 | 4 |
|
5 | 5 | #include <test/fuzz/FuzzedDataProvider.h>
|
6 | 6 | #include <test/fuzz/fuzz.h>
|
7 | 7 | #include <test/fuzz/util.h>
|
8 | 8 | #include <test/util/setup_common.h>
|
| 9 | +#include <validation.h> |
9 | 10 | #include <wallet/coincontrol.h>
|
10 | 11 | #include <wallet/fees.h>
|
11 |
| -#include <wallet/wallet.h> |
12 | 12 | #include <wallet/test/util.h>
|
13 |
| -#include <validation.h> |
| 13 | +#include <wallet/wallet.h> |
14 | 14 |
|
15 | 15 | namespace wallet {
|
16 | 16 | namespace {
|
17 | 17 | const TestingSetup* g_setup;
|
18 |
| -static std::unique_ptr<CWallet> g_wallet_ptr; |
19 | 18 |
|
20 | 19 | void initialize_setup()
|
21 | 20 | {
|
22 | 21 | static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
|
23 | 22 | g_setup = testing_setup.get();
|
24 |
| - const auto& node{g_setup->m_node}; |
25 |
| - g_wallet_ptr = std::make_unique<CWallet>(node.chain.get(), "", CreateMockableWalletDatabase()); |
26 | 23 | }
|
27 | 24 |
|
28 | 25 | FUZZ_TARGET(wallet_fees, .init = initialize_setup)
|
29 | 26 | {
|
| 27 | + SeedRandomStateForTest(SeedRand::ZEROS); |
30 | 28 | FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
| 29 | + SetMockTime(ConsumeTime(fuzzed_data_provider)); |
31 | 30 | const auto& node{g_setup->m_node};
|
32 | 31 | Chainstate* chainstate = &node.chainman->ActiveChainstate();
|
33 |
| - CWallet& wallet = *g_wallet_ptr; |
| 32 | + std::unique_ptr<CWallet> wallet_ptr{std::make_unique<CWallet>(node.chain.get(), "", CreateMockableWalletDatabase())}; |
| 33 | + CWallet& wallet{*wallet_ptr}; |
34 | 34 | {
|
35 | 35 | LOCK(wallet.cs_wallet);
|
36 | 36 | wallet.SetLastBlockProcessed(chainstate->m_chain.Height(), chainstate->m_chain.Tip()->GetBlockHash());
|
|
0 commit comments