From fa427ffceeefd368a1ade273501ce4b01133ad4d Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 13 May 2025 22:58:33 +0200 Subject: [PATCH] fuzz: Properly setup wallet in wallet_fees target Co-Authored-By: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> --- src/wallet/test/fuzz/fees.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/wallet/test/fuzz/fees.cpp b/src/wallet/test/fuzz/fees.cpp index c2e785651ad..a8da63b488f 100644 --- a/src/wallet/test/fuzz/fees.cpp +++ b/src/wallet/test/fuzz/fees.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2022 The Bitcoin Core developers +// Copyright (c) 2022-present The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -6,31 +6,31 @@ #include #include #include +#include #include #include -#include #include -#include +#include namespace wallet { namespace { const TestingSetup* g_setup; -static std::unique_ptr g_wallet_ptr; void initialize_setup() { static const auto testing_setup = MakeNoLogFileContext(); g_setup = testing_setup.get(); - const auto& node{g_setup->m_node}; - g_wallet_ptr = std::make_unique(node.chain.get(), "", CreateMockableWalletDatabase()); } FUZZ_TARGET(wallet_fees, .init = initialize_setup) { + SeedRandomStateForTest(SeedRand::ZEROS); FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()}; + SetMockTime(ConsumeTime(fuzzed_data_provider)); const auto& node{g_setup->m_node}; Chainstate* chainstate = &node.chainman->ActiveChainstate(); - CWallet& wallet = *g_wallet_ptr; + std::unique_ptr wallet_ptr{std::make_unique(node.chain.get(), "", CreateMockableWalletDatabase())}; + CWallet& wallet{*wallet_ptr}; { LOCK(wallet.cs_wallet); wallet.SetLastBlockProcessed(chainstate->m_chain.Height(), chainstate->m_chain.Tip()->GetBlockHash());