Skip to content

Commit fae7e37

Browse files
author
MarcoFalke
committed
test: Correct the random seed log on a prevector test failure
rand_cache is unused since commit 1632922, so it can be removed rand_seed is wrong since commit 022cf47, 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 commit fae43a9, 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.
1 parent 60b8164 commit fae7e37

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/test/prevector_tests.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class prevector_tester {
2727

2828
typedef typename pretype::size_type Size;
2929
bool passed = true;
30-
FastRandomContext rand_cache;
3130
uint256 rand_seed;
3231

3332

@@ -209,9 +208,8 @@ class prevector_tester {
209208
}
210209

211210
prevector_tester() {
212-
SeedRandomForTest();
213211
rand_seed = InsecureRand256();
214-
rand_cache.Reseed(rand_seed);
212+
g_insecure_rand_ctx.Reseed(rand_seed);
215213
}
216214
};
217215

0 commit comments

Comments
 (0)