mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
test: Correct the random seed log on a prevector test failure
rand_cache is unused since commit16329224e7
, so it can be removed rand_seed is wrong since commit022cf47dd7
, because it is no longer printing the seed that was used to seed the global random context in tests. Instead, it prints a (random-ish) value derived from the global random context via InsecureRand256(). Finally, the for loop creating new prevector_tester objects will always use the same seed since commitfae43a97ca
, because repeated calls to SeedInsecureRand/SeedRandomForTest will always reseed the global with the same "static const" seed. Fix all issues by * removing the unused rand_cache, * removing the call to SeedRandomForTest which restored the same seed on every call in the process, and * Reseeding the global random context with the (random-ish) rand_seed.
This commit is contained in:
parent
60b816439e
commit
fae7e3791c
1 changed files with 1 additions and 3 deletions
|
@ -27,7 +27,6 @@ class prevector_tester {
|
|||
|
||||
typedef typename pretype::size_type Size;
|
||||
bool passed = true;
|
||||
FastRandomContext rand_cache;
|
||||
uint256 rand_seed;
|
||||
|
||||
|
||||
|
@ -209,9 +208,8 @@ public:
|
|||
}
|
||||
|
||||
prevector_tester() {
|
||||
SeedRandomForTest();
|
||||
rand_seed = InsecureRand256();
|
||||
rand_cache.Reseed(rand_seed);
|
||||
g_insecure_rand_ctx.Reseed(rand_seed);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue