MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ShouldCompactChainstate

Function ShouldCompactChainstate

src/validation.cpp:117–121  ·  view source on GitHub ↗

Return whether the completed full flush should compact chainstate

Source from the content-addressed store, hash-verified

115
116// Return whether the completed full flush should compact chainstate
117static bool ShouldCompactChainstate(bool in_ibd)
118{
119 static constexpr uint32_t flush_ratio{320}; // Roughly every 2 weeks with hourly flushes
120 return !in_ibd && FastRandomContext().randrange(flush_ratio) == 0;
121}
122
123TRACEPOINT_SEMAPHORE(validation, block_connected);
124TRACEPOINT_SEMAPHORE(utxocache, flush);

Callers 1

FlushStateToDiskMethod · 0.85

Calls 2

randrangeMethod · 0.80
FastRandomContextClass · 0.70

Tested by

no test coverage detected