aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-08-21 17:23:49 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-08-21 23:27:08 +0200
commitfae7e3791c9ed8053166773fcfb583ad19d006dd (patch)
tree553824185fb0378f8b141ffd17b0b241d81c8858 /src
parent60b816439eb4bd837778d424628cd3978e0856d9 (diff)
downloadbitcoin-fae7e3791c9ed8053166773fcfb583ad19d006dd.tar.xz
test: Correct the random seed log on a prevector test failure
rand_cache is unused since commit 16329224e70d0525208f6b0ba00c5e1531a4f5ea, so it can be removed rand_seed is wrong since commit 022cf47dd7ef8f46e32a184e84f94d1e9f3a495c, 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 fae43a97ca947cd0802392e9bb86d9d0572c0fba, 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.
Diffstat (limited to 'src')
-rw-r--r--src/test/prevector_tests.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/test/prevector_tests.cpp b/src/test/prevector_tests.cpp
index f5f0cbee58..1f6e6c04c2 100644
--- a/src/test/prevector_tests.cpp
+++ b/src/test/prevector_tests.cpp
@@ -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);
}
};