Bitcoin Core 31.99.0
P2P Digital Currency
cmpctblock.cpp
Go to the documentation of this file.
1// Copyright (c) 2026 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 <addrman.h>
6#include <blockencodings.h>
7#include <chain.h>
8#include <chainparams.h>
9#include <coins.h>
10#include <consensus/amount.h>
11#include <consensus/consensus.h>
12#include <consensus/merkle.h>
13#include <net.h>
14#include <net_processing.h>
15#include <netmessagemaker.h>
16#include <node/blockstorage.h>
17#include <policy/truc_policy.h>
18#include <primitives/block.h>
20#include <protocol.h>
21#include <script/script.h>
22#include <serialize.h>
23#include <sync.h>
25#include <test/fuzz/fuzz.h>
26#include <test/fuzz/util.h>
27#include <test/fuzz/util/net.h>
28#include <test/util/net.h>
29#include <test/util/random.h>
30#include <test/util/script.h>
32#include <test/util/time.h>
34#include <txmempool.h>
35#include <uint256.h>
36#include <util/check.h>
37#include <util/task_runner.h>
38#include <util/time.h>
39#include <validation.h>
40#include <validationinterface.h>
41
42#include <boost/multi_index/detail/hash_index_iterator.hpp>
43
44#include <cstddef>
45#include <cstdint>
46#include <functional>
47#include <iterator>
48#include <memory>
49#include <optional>
50#include <string>
51#include <thread>
52#include <utility>
53#include <vector>
54
55namespace {
56
58
60const CAmount AMOUNT_FEE{1000};
62std::vector<std::pair<COutPoint, CAmount>> g_mature_coinbase;
64uint32_t g_nBits;
66struct BlockInfo {
67 std::shared_ptr<CBlock> block;
68 uint256 hash;
69 uint32_t height;
70};
72class FuzzedCBlockHeaderAndShortTxIDs : public CBlockHeaderAndShortTxIDs
73{
75
76public:
77 void AddPrefilledTx(PrefilledTransaction&& prefilledtx)
78 {
79 prefilledtxn.push_back(std::move(prefilledtx));
80 }
81
82 void RemoveCoinbasePrefill()
83 {
84 prefilledtxn.erase(prefilledtxn.begin());
85 }
86
87 void InsertCoinbaseShortTxID(uint64_t shorttxid)
88 {
89 shorttxids.insert(shorttxids.begin(), shorttxid);
90 }
91
92 void EraseShortTxIDs(size_t index)
93 {
94 shorttxids.erase(shorttxids.begin() + index);
95 }
96
97 size_t PrefilledTxCount() {
98 return prefilledtxn.size();
99 }
100
101 size_t ShortTxIDCount() {
102 return shorttxids.size();
103 }
104};
105
106
108class ImmediateBackgroundTaskRunner : public util::TaskRunnerInterface
109{
110public:
111 void insert(std::function<void()> func) override { std::thread(std::move(func)).join(); }
112 void flush() override {}
113 size_t size() override { return 0; }
114};
115
116} // namespace
117
118extern void MakeRandDeterministicDANGEROUS(const uint256& seed) noexcept;
119
121{
122 static const auto testing_setup = MakeNoLogFileContext<TestingSetup>();
123 g_setup = testing_setup.get();
124 g_nBits = Params().GenesisBlock().nBits;
125 // Replace validation_signals before creating chainman and mempool so they use it.
126 testing_setup->m_node.validation_signals = std::make_unique<ValidationSignals>(std::make_unique<ImmediateBackgroundTaskRunner>());
127 g_mature_coinbase = ResetChainmanAndMempool(*g_setup);
128}
129
131{
133 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
134
135 GetFakeNodeClock().set(1610000000s);
136 FakeSteadyClock steady_clock;
137
138 auto setup = g_setup;
139 auto& mempool = *setup->m_node.mempool;
140 auto& chainman = static_cast<TestChainstateManager&>(*setup->m_node.chainman);
141 chainman.ResetIbd();
142 chainman.DisableNextWrite();
143 const size_t initial_index_size{WITH_LOCK(chainman.GetMutex(), return chainman.BlockIndex().size())};
144
145 AddrMan addrman{*setup->m_node.netgroupman, /*deterministic=*/true, /*consistency_check_ratio=*/0};
146 auto& connman = *static_cast<ConnmanTestMsg*>(setup->m_node.connman.get());
147 auto peerman = PeerManager::make(connman, addrman,
148 /*banman=*/nullptr, chainman,
149 mempool, *setup->m_node.warnings,
151 .deterministic_rng = true,
152 });
153 connman.SetMsgProc(peerman.get());
154
155 setup->m_node.validation_signals->RegisterValidationInterface(peerman.get());
156 setup->m_node.validation_signals->SyncWithValidationInterfaceQueue();
157
159
160 std::vector<CNode*> peers;
161 for (int i = 0; i < 4; ++i) {
162 peers.push_back(ConsumeNodeAsUniquePtr(fuzzed_data_provider, steady_clock, i).release());
163 CNode& p2p_node = *peers.back();
164 FillNode(fuzzed_data_provider, connman, p2p_node);
165 connman.AddTestNode(p2p_node);
166 }
167
168 // Stores blocks generated this iteration.
169 std::vector<BlockInfo> info;
170
171 // Coinbase UTXOs for this iteration.
172 std::vector<std::pair<COutPoint, CAmount>> mature_coinbase = g_mature_coinbase;
173
174 const uint64_t initial_sequence{WITH_LOCK(mempool.cs, return mempool.GetSequence())};
175
176 auto create_tx = [&]() -> CTransactionRef {
177 CMutableTransaction tx_mut;
180
181 // Choose an outpoint from the mempool, created blocks, or coinbases.
182 CAmount amount_in;
183 COutPoint outpoint;
184 unsigned long mempool_size = mempool.size();
185 if (mempool_size != 0 && fuzzed_data_provider.ConsumeBool()) {
186 size_t random_idx = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, mempool_size - 1);
187 CTransactionRef tx = WITH_LOCK(mempool.cs, return mempool.txns_randomized[random_idx].second->GetSharedTx(););
188 outpoint = COutPoint(tx->GetHash(), 0);
189 amount_in = tx->vout[0].nValue;
190 } else if (info.size() != 0 && fuzzed_data_provider.ConsumeBool()) {
191 // These blocks (and txs) may be invalid, use a spent output, or not be in the main chain.
192 auto info_it = info.begin();
193 std::advance(info_it, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, info.size() - 1));
194 auto tx_it = info_it->block->vtx.begin();
195 std::advance(tx_it, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, info_it->block->vtx.size() - 1));
196 outpoint = COutPoint(tx_it->get()->GetHash(), 0);
197 amount_in = tx_it->get()->vout[0].nValue;
198 } else {
199 auto coinbase_it = mature_coinbase.begin();
200 std::advance(coinbase_it, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, mature_coinbase.size() - 1));
201 outpoint = coinbase_it->first;
202 amount_in = coinbase_it->second;
203 }
204
206 const auto script_sig = CScript{};
207 const auto script_wit_stack = std::vector<std::vector<uint8_t>>{WITNESS_STACK_ELEM_OP_TRUE};
208
209 CTxIn in;
210 in.prevout = outpoint;
211 in.nSequence = sequence;
212 in.scriptSig = script_sig;
213 in.scriptWitness.stack = script_wit_stack;
214 tx_mut.vin.push_back(in);
215
216 const CAmount amount_out = amount_in - AMOUNT_FEE;
217 tx_mut.vout.emplace_back(amount_out, P2WSH_OP_TRUE);
218
219 auto tx = MakeTransactionRef(tx_mut);
220 return tx;
221 };
222
223 auto create_block = [&]() {
224 uint256 prev;
225 uint32_t height;
226
227 if (info.size() == 0 || fuzzed_data_provider.ConsumeBool()) {
228 LOCK(cs_main);
229 prev = chainman.ActiveChain().Tip()->GetBlockHash();
230 height = chainman.ActiveChain().Height() + 1;
231 } else {
232 size_t index = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, info.size() - 1);
233 prev = info[index].hash;
234 height = info[index].height + 1;
235 }
236
237 const auto new_time = WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip()->GetMedianTimePast() + 1);
238
239 CBlockHeader header;
240 header.nNonce = 0;
241 header.hashPrevBlock = prev;
242 header.nBits = g_nBits;
243 header.nTime = new_time;
245
246 std::shared_ptr<CBlock> block = std::make_shared<CBlock>();
247 *block = header;
248
249 CMutableTransaction coinbase_tx;
250 coinbase_tx.vin.resize(1);
251 coinbase_tx.vin[0].prevout.SetNull();
252 coinbase_tx.vin[0].scriptSig = CScript() << height << OP_0;
253 coinbase_tx.vout.resize(1);
254 coinbase_tx.vout[0].scriptPubKey = CScript() << OP_TRUE;
255 coinbase_tx.vout[0].nValue = COIN;
256 block->vtx.push_back(MakeTransactionRef(coinbase_tx));
257
258 const auto mempool_size = mempool.size();
259 if (fuzzed_data_provider.ConsumeBool() && mempool_size != 0) {
260 // Add txns from the mempool. Since we do not include parents, it may be an invalid block.
261 size_t num_txns = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(1, mempool_size);
262 size_t random_idx = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, mempool_size - 1);
263
264 LOCK(mempool.cs);
265 for (size_t i = random_idx; i < random_idx + num_txns; ++i) {
266 CTransactionRef mempool_tx = mempool.txns_randomized[i % mempool_size].second->GetSharedTx();
267 block->vtx.push_back(mempool_tx);
268 }
269 }
270
271 // Create and add (possibly invalid) txns that are not in the mempool.
273 size_t new_txns = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(1, 10);
274 for (size_t i = 0; i < new_txns; ++i) {
275 CTransactionRef non_mempool_tx = create_tx();
276 block->vtx.push_back(non_mempool_tx);
277 }
278 }
279
280 CBlockIndex* pindexPrev{WITH_LOCK(::cs_main, return chainman.m_blockman.LookupBlockIndex(prev))};
281 chainman.GenerateCoinbaseCommitment(*block, pindexPrev);
282
283 bool mutated;
284 block->hashMerkleRoot = BlockMerkleRoot(*block, &mutated);
285 FinalizeHeader(*block, chainman);
286
287 BlockInfo block_info;
288 block_info.block = block;
289 block_info.hash = block->GetHash();
290 block_info.height = height;
291
292 return block_info;
293 };
294
296 CSerializedNetMsg net_msg;
297 bool sent_net_msg = true;
298 bool requested_hb = false;
299 bool sent_sendcmpct = false;
300 bool valid_sendcmpct = false;
301
302 CallOneOf(
304 [&]() {
305 // Send a compact block.
306 std::shared_ptr<CBlock> cblock;
307
308 // Pick an existing block or create a new block.
309 if (fuzzed_data_provider.ConsumeBool() && info.size() != 0) {
310 size_t index = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, info.size() - 1);
311 cblock = info[index].block;
312 } else {
313 BlockInfo block_info = create_block();
314 cblock = block_info.block;
315 info.push_back(block_info);
316 }
317
318 uint64_t nonce = fuzzed_data_provider.ConsumeIntegral<uint64_t>();
319 FuzzedCBlockHeaderAndShortTxIDs cmpctblock(*cblock, nonce);
320
322 CBlockHeaderAndShortTxIDs base_cmpctblock = cmpctblock;
323 net_msg = NetMsg::Make(NetMsgType::CMPCTBLOCK, base_cmpctblock);
324 return;
325 }
326
327 int prev_idx = 0;
328 size_t num_erased = 1;
329 size_t num_txs = cblock->vtx.size();
330
331 for (size_t i = 0; i < num_txs; ++i) {
332 if (i == 0) {
333 // Handle the coinbase specially. We either keep it prefilled or remove it.
334 if (fuzzed_data_provider.ConsumeBool()) continue;
335
336 // Remove the prefilled coinbase.
337 num_erased = 0;
338 uint64_t coinbase_shortid = cmpctblock.GetShortID(cblock->vtx[0]->GetWitnessHash());
339 cmpctblock.RemoveCoinbasePrefill();
340 cmpctblock.InsertCoinbaseShortTxID(coinbase_shortid);
341 continue;
342 }
343
344 if (fuzzed_data_provider.ConsumeBool()) continue;
345
346 uint16_t prefill_idx = num_erased == 0 ? i : i - prev_idx - 1;
347 prev_idx = i;
348 CTransactionRef txref = cblock->vtx[i];
349 PrefilledTransaction prefilledtx = {/*index=*/prefill_idx, txref};
350 cmpctblock.AddPrefilledTx(std::move(prefilledtx));
351
352 // Remove from shorttxids since we've prefilled. Subtract however many txs have been prefilled.
353 cmpctblock.EraseShortTxIDs(i - num_erased);
354 ++num_erased;
355 }
356
357 assert(cmpctblock.PrefilledTxCount() + cmpctblock.ShortTxIDCount() == num_txs);
358
359 CBlockHeaderAndShortTxIDs base_cmpctblock = cmpctblock;
360 net_msg = NetMsg::Make(NetMsgType::CMPCTBLOCK, base_cmpctblock);
361 },
362 [&]() {
363 // Send a blocktxn message for an existing block (if one exists).
364 size_t num_blocks = info.size();
365 if (num_blocks == 0) {
366 sent_net_msg = false;
367 return;
368 }
369
370 // Fetch an existing block and randomly choose transactions to send over.
371 size_t index = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, num_blocks - 1);
372 const BlockInfo& block_info = info[index];
373 BlockTransactions block_txn;
374 block_txn.blockhash = block_info.hash;
375 std::shared_ptr<CBlock> cblock = block_info.block;
376
377 for (size_t i = 0; i < cblock->vtx.size(); i++) {
378 if (fuzzed_data_provider.ConsumeBool()) continue;
379
380 block_txn.txn.push_back(cblock->vtx[i]);
381 }
382
383 net_msg = NetMsg::Make(NetMsgType::BLOCKTXN, block_txn);
384 },
385 [&]() {
386 // Send a headers message for an existing block (if one exists).
387 size_t num_blocks = info.size();
388 if (num_blocks == 0) {
389 sent_net_msg = false;
390 return;
391 }
392
393 // Choose an existing block and send a HEADERS message for it.
394 size_t index = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, num_blocks - 1);
395 CBlock block = *info[index].block;
396 block.vtx.clear(); // No tx in HEADERS.
397 std::vector<CBlock> headers;
398 headers.emplace_back(block);
399
401 },
402 [&]() {
403 // Send a sendcmpct message, optionally setting hb mode.
406 net_msg = NetMsg::Make(NetMsgType::SENDCMPCT, /*high_bandwidth=*/hb, /*version=*/version);
407 requested_hb = hb;
408 sent_sendcmpct = true;
409 valid_sendcmpct = version == CMPCTBLOCKS_VERSION;
410 },
411 [&]() {
412 // Mine a block, but don't send it.
413 BlockInfo block_info = create_block();
414 info.push_back(block_info);
415 sent_net_msg = false;
416 },
417 [&]() {
418 // Send a transaction.
419 CTransactionRef tx = create_tx();
421 },
422 [&]() {
423 // Set mock time randomly or to tip's time.
426 } else {
427 const NodeSeconds tip_time = WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip()->Time());
428 GetFakeNodeClock().set(tip_time);
429 }
430
431 sent_net_msg = false;
432 });
433
434 if (!sent_net_msg) {
435 continue;
436 }
437
438 CNode& random_node = *PickValue(fuzzed_data_provider, peers);
439 connman.FlushSendBuffer(random_node);
440 (void)connman.ReceiveMsgFrom(random_node, std::move(net_msg));
441
442 bool more_work{true};
443 while (more_work) {
444 random_node.fPauseSend = false;
445
446 more_work = connman.ProcessMessagesOnce(random_node);
447 peerman->SendMessages(random_node);
448 }
449
450 std::vector<CNodeStats> stats;
451 connman.GetNodeStats(stats);
452
453 // We should have at maximum 3 HB peers.
454 int num_hb = 0;
455 for (const CNodeStats& stat : stats) {
456 if (stat.m_bip152_highbandwidth_to) {
457 // HB peers cannot be feelers or other "special" connections (besides addr-fetch).
458 CNode* hb_peer = peers[stat.nodeid];
459 if (!hb_peer->fDisconnect) num_hb += 1;
460 assert(hb_peer->IsInboundConn() || hb_peer->IsOutboundOrBlockRelayConn() || hb_peer->IsManualConn() || hb_peer->IsAddrFetchConn());
461 }
462 }
463 assert(num_hb <= 3);
464
465 if (sent_sendcmpct && !random_node.fDisconnect) {
466 // If the fuzzer sent SENDCMPCT with proper version, check the node's state matches what it sent.
467 const CNodeStats& random_node_stats = stats[random_node.GetId()];
468 if (valid_sendcmpct) assert(random_node_stats.m_bip152_highbandwidth_from == requested_hb);
469 }
470 }
471
472 setup->m_node.validation_signals->SyncWithValidationInterfaceQueue();
473 setup->m_node.validation_signals->UnregisterAllValidationInterfaces();
474 connman.StopNodes();
475
476 const size_t end_index_size{WITH_LOCK(chainman.GetMutex(), return chainman.BlockIndex().size())};
477 const uint64_t end_sequence{WITH_LOCK(mempool.cs, return mempool.GetSequence())};
478
479 if (initial_index_size != end_index_size || initial_sequence != end_sequence) {
481 g_mature_coinbase = ResetChainmanAndMempool(*g_setup);
482 }
483}
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
static constexpr CAmount COIN
The amount of satoshis in one BTC.
Definition: amount.h:15
const TestingSetup * g_setup
const CChainParams & Params()
Return the currently selected parameters.
Stochastic address manager.
Definition: addrman.h:110
std::vector< CTransactionRef > txn
CBlockHeaderAndShortTxIDs()=default
Dummy for deserialization.
Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce value...
Definition: block.h:27
uint32_t nNonce
Definition: block.h:35
uint32_t nBits
Definition: block.h:34
uint32_t nTime
Definition: block.h:33
int32_t nVersion
Definition: block.h:30
uint256 hashPrevBlock
Definition: block.h:31
Definition: block.h:74
std::vector< CTransactionRef > vtx
Definition: block.h:77
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:94
const CBlock & GenesisBlock() const
Definition: chainparams.h:94
Information about a peer.
Definition: net.h:683
bool IsInboundConn() const
Definition: net.h:843
bool IsOutboundOrBlockRelayConn() const
Definition: net.h:778
NodeId GetId() const
Definition: net.h:928
bool IsManualConn() const
Definition: net.h:798
bool IsAddrFetchConn() const
Definition: net.h:827
std::atomic_bool fPauseSend
Definition: net.h:751
std::atomic_bool fDisconnect
Definition: net.h:745
bool m_bip152_highbandwidth_from
Definition: net.h:209
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:29
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:406
static constexpr uint32_t CURRENT_VERSION
Definition: transaction.h:284
An input of a transaction.
Definition: transaction.h:62
uint32_t nSequence
Definition: transaction.h:66
CScript scriptSig
Definition: transaction.h:65
CScriptWitness scriptWitness
Only serialized through CTransaction.
Definition: transaction.h:67
COutPoint prevout
Definition: transaction.h:64
void set(NodeSeconds t)
Set mocktime.
Definition: time.h:71
Helper to initialize the global MockableSteadyClock, let a duration elapse, and reset it after use in...
Definition: time.h:29
T ConsumeIntegralInRange(T min, T max)
static Mutex g_msgproc_mutex
Mutex for anything that is only accessed via the msg processing thread.
Definition: net.h:1044
static std::unique_ptr< PeerManager > make(CConnman &connman, AddrMan &addrman, BanMan *banman, ChainstateManager &chainman, CTxMemPool &pool, node::Warnings &warnings, Options opts)
256-bit opaque blob.
Definition: uint256.h:196
static const uint256 ZERO
Definition: uint256.h:204
virtual size_t size()=0
Returns the number of currently pending events.
virtual void flush()=0
Forces the processing of all pending events.
virtual void insert(std::function< void()> func)=0
The callback can either be queued for later/asynchronous/threaded processing, or be executed immediat...
void MakeRandDeterministicDANGEROUS(const uint256 &seed) noexcept
Internal function to set g_determinstic_rng.
Definition: random.cpp:595
FUZZ_TARGET(cmpctblock,.init=initialize_cmpctblock)
Definition: cmpctblock.cpp:130
void initialize_cmpctblock()
Definition: cmpctblock.cpp:120
for(const auto &cache :caches)
LIMITED_WHILE(provider.remaining_bytes(), 10000)
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
Definition: merkle.cpp:74
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
Definition: cs_main.cpp:8
HTTPHeaders headers
std::thread thread
Thread variable should be after other struct members so the thread does not start until the other mem...
uint64_t sequence
unsigned int nonce
CSerializedNetMsg Make(std::string msg_type, Args &&... args)
constexpr const char * HEADERS
The headers message sends one or more block headers to a node which previously requested certain head...
Definition: protocol.h:123
constexpr const char * CMPCTBLOCK
Contains a CBlockHeaderAndShortTxIDs object - providing a header and list of "short txids".
Definition: protocol.h:206
constexpr const char * BLOCKTXN
Contains a BlockTransactions.
Definition: protocol.h:218
constexpr const char * SENDCMPCT
Contains a 1-byte bool and 8-byte LE version number.
Definition: protocol.h:200
constexpr const char * TX
The tx message transmits a single transaction.
Definition: protocol.h:117
Definition: basic.cpp:8
static constexpr uint64_t CMPCTBLOCKS_VERSION
The compactblocks version we support.
static constexpr TransactionSerParams TX_WITH_WITNESS
Definition: transaction.h:180
static CTransactionRef MakeTransactionRef(Tx &&txIn)
Definition: transaction.h:404
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:403
@ OP_TRUE
Definition: script.h:85
@ OP_0
Definition: script.h:77
A mutable version of CTransaction.
Definition: transaction.h:358
std::vector< CTxOut > vout
Definition: transaction.h:360
std::vector< CTxIn > vin
Definition: transaction.h:359
std::vector< std::vector< unsigned char > > stack
Definition: script.h:581
void ResetIbd()
Reset the ibd cache to its initial state.
Definition: validation.cpp:46
Testing setup that configures a complete environment.
Definition: setup_common.h:115
#define LOCK(cs)
Definition: sync.h:268
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
Definition: sync.h:299
This header provides an interface and simple implementation for a task runner.
SeedRandomStateForTest(SeedRand::ZEROS)
void FillNode(FuzzedDataProvider &fuzzed_data_provider, ConnmanTestMsg &connman, CNode &node) noexcept
Definition: net.cpp:450
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, FakeSteadyClock &clock, const std::optional< NodeId > &node_id_in=std::nullopt)
Definition: net.h:310
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
Definition: util.cpp:34
uint32_t ConsumeSequence(FuzzedDataProvider &fuzzed_data_provider) noexcept
Definition: util.cpp:155
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
Definition: util.h:57
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
Definition: util.h:37
void FinalizeHeader(CBlockHeader &header, const ChainstateManager &chainman)
Definition: util.h:367
@ ZEROS
Seed with a compile time constant of zeros.
static const std::vector< uint8_t > WITNESS_STACK_ELEM_OP_TRUE
Definition: script.h:12
static const CScript P2WSH_OP_TRUE
Definition: script.h:13
FakeNodeClock & GetFakeNodeClock()
Definition: time.h:79
std::vector< std::pair< COutPoint, CAmount > > ResetChainmanAndMempool(TestingSetup &setup)
Definition: validation.cpp:108
static int setup(void)
Definition: tests.c:8082
static constexpr decltype(CTransaction::version) TRUC_VERSION
Definition: truc_policy.h:20
std::chrono::time_point< NodeClock, std::chrono::seconds > NodeSeconds
Definition: time.h:35
assert(!tx.IsCoinBase())
FuzzedDataProvider & fuzzed_data_provider
Definition: fees.cpp:39