aboutsummaryrefslogtreecommitdiff
path: root/src/random.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2019-10-29 11:55:59 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2019-11-12 15:35:26 -0800
commitd61f2bb076d8f17840a8e79f1583d7f6e3e6d09a (patch)
treee36bc22346ff81282bc46dffea7ba9313fc49e0f /src/random.h
parent483b94292e89587e5ab40a30b8a90e2f56e847f3 (diff)
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).
Diffstat (limited to 'src/random.h')
-rw-r--r--src/random.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/random.h b/src/random.h
index b5a7faf48c..7768f9d3c5 100644
--- a/src/random.h
+++ b/src/random.h
@@ -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