Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/test/util/setup_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <test/util/net.h>
#include <test/util/txmempool.h>
#include <txdb.h>
#include <util/check.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/thread.h>
Expand Down Expand Up @@ -156,6 +157,15 @@ void DashChainstateSetupClose(NodeContext& node)
Assert(node.mempool.get()));
}

struct NetworkSetup
{
NetworkSetup()
{
Assert(SetupNetworking());
}
};
static NetworkSetup g_networksetup_instance;

BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::vector<const char*>& extra_args)
: m_path_root{fs::temp_directory_path() / "test_common_" PACKAGE_NAME / g_insecure_rand_ctx_temp_path.rand256().ToString()},
m_args{}
Expand Down Expand Up @@ -201,7 +211,6 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
ECC_Start();
BLSInit();
SetupEnvironment();
SetupNetworking();
InitSignatureCache();
InitScriptExecutionCache();

Expand Down
3 changes: 3 additions & 0 deletions src/test/util_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,9 @@ BOOST_AUTO_TEST_CASE(test_LockDirectory)
// has released the lock as we would expect by probing it.
int processstatus;
BOOST_CHECK_EQUAL(write(fd[1], &LockCommand, 1), 1);
// The following line invokes the ~CNetCleanup dtor without
// a paired SetupNetworking call. This is acceptable as long as
// ~CNetCleanup is a no-op for non-Windows platforms.
BOOST_CHECK_EQUAL(write(fd[1], &ExitCommand, 1), 1);
BOOST_CHECK_EQUAL(waitpid(pid, &processstatus, 0), pid);
BOOST_CHECK_EQUAL(processstatus, 0);
Expand Down
4 changes: 2 additions & 2 deletions src/wallet/test/fuzz/notifications.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 The Bitcoin Core developers
// Copyright (c) 2021-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.

Expand Down Expand Up @@ -84,7 +84,7 @@ FUZZ_TARGET(wallet_notifications, .init = initialize_setup)
// The total amount, to be distributed to the wallets a and b in txs
// without fee. Thus, the balance of the wallets should always equal the
// total amount.
const auto total_amount{ConsumeMoney(fuzzed_data_provider)};
const auto total_amount{ConsumeMoney(fuzzed_data_provider, /*max=*/MAX_MONEY / 100000)};
FuzzedWallet a{"fuzzed_wallet_a"};
FuzzedWallet b{"fuzzed_wallet_b"};

Expand Down
Loading