Bitcoin Core 28.99.0
P2P Digital Currency
signet.cpp
Go to the documentation of this file.
1// Copyright (c) 2020-2021 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <chainparams.h>
7#include <primitives/block.h>
8#include <signet.h>
9#include <streams.h>
11#include <test/fuzz/fuzz.h>
12#include <test/fuzz/util.h>
14#include <util/chaintype.h>
15
16#include <cstdint>
17#include <optional>
18#include <vector>
19
21{
22 static const auto testing_setup = MakeNoLogFileContext<>(ChainType::SIGNET);
23}
24
26{
27 FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
28 const std::optional<CBlock> block = ConsumeDeserializable<CBlock>(fuzzed_data_provider, TX_WITH_WITNESS);
29 if (!block) {
30 return;
31 }
33 (void)SignetTxs::Create(*block, ConsumeScript(fuzzed_data_provider));
34}
const CChainParams & Params()
Return the currently selected parameters.
const Consensus::Params & GetConsensus() const
Definition: chainparams.h:93
static std::optional< SignetTxs > Create(const CBlock &block, const CScript &challenge)
Definition: signet.cpp:69
static constexpr TransactionSerParams TX_WITH_WITNESS
Definition: transaction.h:195
bool CheckSignetBlockSolution(const CBlock &block, const Consensus::Params &consensusParams)
Extract signature and check whether a block has a valid solution.
Definition: signet.cpp:125
FUZZ_TARGET(signet,.init=initialize_signet)
Definition: signet.cpp:25
void initialize_signet()
Definition: signet.cpp:20
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
Definition: util.cpp:93