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

Method Check

src/test/fuzz/txrequest.cpp:286–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284 }
285
286 void Check()
287 {
288 // Compare CountTracked and CountLoad with naive structure.
289 size_t total = 0;
290 for (int peer = 0; peer < MAX_PEERS; ++peer) {
291 size_t tracked = 0;
292 size_t inflight = 0;
293 size_t candidates = 0;
294 for (int txhash = 0; txhash < MAX_TXHASHES; ++txhash) {
295 tracked += m_announcements[txhash][peer].m_state != State::NOTHING;
296 inflight += m_announcements[txhash][peer].m_state == State::REQUESTED;
297 candidates += m_announcements[txhash][peer].m_state == State::CANDIDATE;
298 }
299 assert(m_tracker.Count(peer) == tracked);
300 assert(m_tracker.CountInFlight(peer) == inflight);
301 assert(m_tracker.CountCandidates(peer) == candidates);
302 total += tracked;
303 }
304 // Compare Size.
305 assert(m_tracker.Size() == total);
306
307 // Invoke internal consistency check of TxRequestTracker object.
308 m_tracker.SanityCheck();
309 }
310};
311} // namespace
312

Callers 1

FUZZ_TARGETFunction · 0.45

Calls 5

CountMethod · 0.45
CountInFlightMethod · 0.45
CountCandidatesMethod · 0.45
SizeMethod · 0.45
SanityCheckMethod · 0.45

Tested by

no test coverage detected