Merge 31ce305d46 into merged_master (Bitcoin PR bitcoin/bitcoin#28952)

This commit is contained in:
Byron Hambly 2025-11-11 10:16:24 +02:00
commit c60ad697e2
No known key found for this signature in database
GPG key ID: DE8F6EA20A661697

View file

@ -1,4 +1,4 @@
// Copyright (c) 2020-2022 The Bitcoin Core developers
// Copyright (c) 2020-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,6 +6,8 @@
#include <net.h>
#include <net_processing.h>
#include <protocol.h>
#include <script/script.h>
#include <sync.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
@ -14,9 +16,15 @@
#include <test/util/net.h>
#include <test/util/setup_common.h>
#include <test/util/validation.h>
#include <validation.h>
#include <util/chaintype.h>
#include <util/time.h>
#include <validationinterface.h>
#include <ios>
#include <string>
#include <utility>
#include <vector>
namespace {
const TestingSetup* g_setup;
} // namespace
@ -55,16 +63,8 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages)
connman.AddTestNode(p2p_node);
}
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100) {
// ELEMENTS: this loop runs on a single core and achieves nothing that couldn't
// be achieved by just repeating the fuzz runs. It typically takes around 11
// minutes on Bitcoin and around 60 minutes on Elements (presumably because the
// seed vectors aren't valid Elements messages so the fuzzer gets lost and starts
// adding tons of iterations).
//
// Capping to 100 iterations reduces the run time to 4-5 minutes on both Bitcoin
// and Elements.
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 30)
{
const std::string random_message_type{fuzzed_data_provider.ConsumeBytesAsString(CMessageHeader::COMMAND_SIZE).c_str()};
const auto mock_time = ConsumeTime(fuzzed_data_provider);