Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
script_sigcache.cpp
Go to the documentation of this file.
1// Copyright (c) 2020-present 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 <consensus/amount.h>
7#include <pubkey.h>
9#include <script/sigcache.h>
10#include <span.h>
12#include <test/fuzz/fuzz.h>
13#include <test/fuzz/util.h>
15#include <uint256.h>
16
17#include <cstddef>
18#include <optional>
19#include <vector>
20
22{
23 static const auto testing_setup = MakeNoLogFileContext<>();
24}
25
27{
29 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
30
33
36 const unsigned int n_in = fuzzed_data_provider.ConsumeIntegral<unsigned int>();
38 const bool store = fuzzed_data_provider.ConsumeBool();
42 const auto random_bytes = fuzzed_data_provider.ConsumeBytes<unsigned char>(64);
44 if (random_bytes.size() == 64) {
46 }
47 } else {
50 if (pub_key) {
51 if (!random_bytes.empty()) {
53 }
54 }
55 }
56}
int64_t CAmount
Amount in satoshis (Can be negative)
Definition amount.h:12
The basic transaction that is broadcasted on the network and contained in blocks.
std::vector< T > ConsumeBytes(size_t num_bytes)
T ConsumeIntegralInRange(T min, T max)
Valid signature cache, to avoid doing expensive ECDSA signature checking twice for every transaction ...
Definition sigcache.h:39
#define FUZZ_TARGET(...)
Definition fuzz.h:35
static constexpr TransactionSerParams TX_WITH_WITNESS
void initialize_script_sigcache()
static constexpr size_t DEFAULT_SIGNATURE_CACHE_BYTES
Definition sigcache.h:29
A mutable version of CTransaction.
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
Definition util.cpp:29
uint256 ConsumeUInt256(FuzzedDataProvider &fuzzed_data_provider) noexcept
Definition util.h:167
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
Definition util.h:57
void SeedRandomStateForTest(SeedRand seedtype)
Seed the global RNG state for testing and log the seed value.
Definition random.cpp:19
@ ZEROS
Seed with a compile time constant of zeros.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition time.h:73
FuzzedDataProvider & fuzzed_data_provider
Definition fees.cpp:38