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

Function Finish

src/test/fuzz/tx_pool.cpp:93–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, CChainState& chainstate)
94{
95 WITH_LOCK(::cs_main, tx_pool.check(chainstate.m_chain.Tip(), chainstate.CoinsTip(), chainstate.m_chain.Height() + 1));
96 {
97 BlockAssembler::Options options;
98 options.nBlockMaxWeight = fuzzed_data_provider.ConsumeIntegralInRange(0U, MAX_BLOCK_WEIGHT);
99 options.blockMinFeeRate = CFeeRate{ConsumeMoney(fuzzed_data_provider, /*max=*/COIN)};
100 auto assembler = BlockAssembler{chainstate, *static_cast<CTxMemPool*>(&tx_pool), chainstate.m_params, options};
101 auto block_template = assembler.CreateNewBlock(CScript{} << OP_TRUE);
102 Assert(block_template->block.vtx.size() >= 1);
103 }
104 const auto info_all = tx_pool.infoAll();
105 if (!info_all.empty()) {
106 const auto& tx_to_remove = *PickValue(fuzzed_data_provider, info_all).tx;
107 WITH_LOCK(tx_pool.cs, tx_pool.removeRecursive(tx_to_remove, MemPoolRemovalReason::BLOCK /* dummy */));
108 std::vector<uint256> all_txids;
109 tx_pool.queryHashes(all_txids);
110 assert(all_txids.size() < info_all.size());
111 WITH_LOCK(::cs_main, tx_pool.check(chainstate.m_chain.Tip(), chainstate.CoinsTip(), chainstate.m_chain.Height() + 1));
112 }
113 SyncWithValidationInterfaceQueue();
114}
115
116void MockTime(FuzzedDataProvider& fuzzed_data_provider, const CChainState& chainstate)
117{

Callers 1

FUZZ_TARGET_INITFunction · 0.85

Calls 12

ConsumeMoneyFunction · 0.85
HeightMethod · 0.80
CreateNewBlockMethod · 0.80
infoAllMethod · 0.80
removeRecursiveMethod · 0.80
queryHashesMethod · 0.80
checkMethod · 0.45
TipMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected