aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-10-31 14:25:11 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-12-12 14:22:12 -0800
commit8d98d426116f0178612f14d1874d331042c4c4b7 (patch)
tree9ca9e096ec04b5b1332578a06b26a9acc43467ec /src/test
parent273d02580aa736b7ccea8fce51d90541665fdbd1 (diff)
downloadbitcoin-8d98d426116f0178612f14d1874d331042c4c4b7.tar.xz
Bugfix: randbytes should seed when needed (non reachable issue)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/random_tests.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/test/random_tests.cpp b/src/test/random_tests.cpp
index 9d69d1247d..1057d09471 100644
--- a/src/test/random_tests.cpp
+++ b/src/test/random_tests.cpp
@@ -38,11 +38,18 @@ BOOST_AUTO_TEST_CASE(fastrandom_tests)
BOOST_CHECK(ctx1.randbytes(50) == ctx2.randbytes(50));
// Check that a nondeterministic ones are not
- FastRandomContext ctx3;
- FastRandomContext ctx4;
- BOOST_CHECK(ctx3.rand64() != ctx4.rand64()); // extremely unlikely to be equal
- BOOST_CHECK(ctx3.rand256() != ctx4.rand256());
- BOOST_CHECK(ctx3.randbytes(7) != ctx4.randbytes(7));
+ {
+ FastRandomContext ctx3, ctx4;
+ BOOST_CHECK(ctx3.rand64() != ctx4.rand64()); // extremely unlikely to be equal
+ }
+ {
+ FastRandomContext ctx3, ctx4;
+ BOOST_CHECK(ctx3.rand256() != ctx4.rand256());
+ }
+ {
+ FastRandomContext ctx3, ctx4;
+ BOOST_CHECK(ctx3.randbytes(7) != ctx4.randbytes(7));
+ }
}
BOOST_AUTO_TEST_CASE(fastrandom_randbits)