Bitcoin Core 32.99.0
P2P Digital Currency
Loading...
Searching...
No Matches
merkleblock.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 <merkleblock.h>
7#include <test/fuzz/fuzz.h>
8#include <test/fuzz/util.h>
9#include <uint256.h>
10
11#include <cstdint>
12#include <optional>
13#include <string>
14#include <vector>
15
17{
18 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
22 [&] {
26 }
27 },
28 [&] {
31 CBloomFilter bloom_filter;
32 std::set<Txid> txids;
33 if (opt_block && !opt_block->vtx.empty()) {
35 merkle_block = CMerkleBlock{*opt_block, bloom_filter};
36 } else if (fuzzed_data_provider.ConsumeBool()) {
39 }
41 }
42 }
44 });
46 std::vector<Txid> matches;
47 std::vector<unsigned int> indices;
48 (void)partial_merkle_tree.ExtractMatches(matches, indices);
49}
BloomFilter is a probabilistic filter which SPV clients provide so that we can filter the transaction...
Definition bloom.h:46
void insert(std::span< const unsigned char > vKey)
Definition bloom.cpp:49
Used to relay blocks as header + vector<merkle branch> to filtered nodes.
CPartialMerkleTree txn
Data structure that represents a partial merkle tree.
Definition merkleblock.h:57
unsigned int GetNumTransactions() const
Get number of transactions the merkle proof is indicating for cross-reference with local blockchain k...
static transaction_identifier FromUint256(const uint256 &id)
#define FUZZ_TARGET(...)
Definition fuzz.h:35
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
Definition fuzz.h:22
constexpr TransactionSerParams TX_WITH_WITNESS
uint256 ConsumeUInt256(FuzzedDataProvider &fuzzed_data_provider) noexcept
Definition util.h:195
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
Definition util.h:37
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition time.h:82
FuzzedDataProvider & fuzzed_data_provider
Definition fees.cpp:46