MCPcopy Create free account
hub / github.com/ElementsProject/elements / FUZZ_TARGET_INIT

Function FUZZ_TARGET_INIT

src/test/fuzz/rbf.cpp:24–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24FUZZ_TARGET_INIT(rbf, initialize_rbf)
25{
26 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
27 SetMockTime(ConsumeTime(fuzzed_data_provider));
28 std::optional<CMutableTransaction> mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider);
29 if (!mtx) {
30 return;
31 }
32 CTxMemPool pool;
33 LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
34 const std::optional<CMutableTransaction> another_mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider);
35 if (!another_mtx) {
36 break;
37 }
38 const CTransaction another_tx{*another_mtx};
39 if (fuzzed_data_provider.ConsumeBool() && !mtx->vin.empty()) {
40 mtx->vin[0].prevout = COutPoint{another_tx.GetHash(), 0};
41 }
42 LOCK2(cs_main, pool.cs);
43 pool.addUnchecked(ConsumeTxMemPoolEntry(fuzzed_data_provider, another_tx));
44 }
45 const CTransaction tx{*mtx};
46 if (fuzzed_data_provider.ConsumeBool()) {
47 LOCK2(cs_main, pool.cs);
48 pool.addUnchecked(ConsumeTxMemPoolEntry(fuzzed_data_provider, tx));
49 }
50 {
51 LOCK(pool.cs);
52 (void)IsRBFOptIn(tx, pool);
53 }
54}

Callers

nothing calls this directly

Calls 10

SetMockTimeFunction · 0.85
ConsumeTimeFunction · 0.85
ConsumeTxMemPoolEntryFunction · 0.85
IsRBFOptInFunction · 0.85
ConsumeBoolMethod · 0.80
addUncheckedMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected