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

Method AddEvent

src/random.cpp:376–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374 }
375
376 void AddEvent(uint32_t event_info) noexcept
377 {
378 LOCK(m_events_mutex);
379
380 m_events_hasher.Write((const unsigned char *)&event_info, sizeof(event_info));
381 // Get the low four bytes of the performance counter. This translates to roughly the
382 // subsecond part.
383 uint32_t perfcounter = (GetPerformanceCounter() & 0xffffffff);
384 m_events_hasher.Write((const unsigned char*)&perfcounter, sizeof(perfcounter));
385 }
386
387 /**
388 * Feed (the hash of) all events added through AddEvent() to hasher.

Callers 1

RandAddEventFunction · 0.80

Calls 2

GetPerformanceCounterFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected