mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Run background seeding periodically instead of unpredictably
* Instead of calling RandAddSeedSleep anytime the scheduler goes idle, call its replacement (RandAddSeedPeriodic) just once per minute. This has better guarantees of actually being run, and helps limit how frequently the dynamic env data is gathered. * Since this code runs once per minute regardless now, we no longer need to keep track of the last time strengthening was run; just do it always. * Make strengthening time context dependent (100 ms at startup, 10 ms once per minute afterwards).
This commit is contained in:
@@ -84,11 +84,11 @@ uint256 GetRandHash() noexcept;
|
||||
void GetStrongRandBytes(unsigned char* buf, int num) noexcept;
|
||||
|
||||
/**
|
||||
* Sleep for 1ms, gather entropy from various sources, and feed them to the PRNG state.
|
||||
* Gather entropy from various expensive sources, and feed them to the PRNG state.
|
||||
*
|
||||
* Thread-safe.
|
||||
*/
|
||||
void RandAddSeedSleep();
|
||||
void RandAddPeriodic();
|
||||
|
||||
/**
|
||||
* Fast randomness source. This is seeded once with secure random data, but
|
||||
|
||||
Reference in New Issue
Block a user