test: Undo thread_local g_insecure_rand_ctx

This commit is contained in:
MarcoFalke
2018-12-17 10:33:53 -05:00
parent b545a6e689
commit fa0d3c4407
3 changed files with 10 additions and 7 deletions

View File

@@ -152,12 +152,13 @@ BOOST_AUTO_TEST_CASE(processnewblock_signals_ordering)
// create a bunch of threads that repeatedly process a block generated above at random
// this will create parallelism and randomness inside validation - the ValidationInterface
// will subscribe to events generated during block validation and assert on ordering invariance
boost::thread_group threads;
std::vector<std::thread> threads;
for (int i = 0; i < 10; i++) {
threads.create_thread([&blocks]() {
threads.emplace_back([&blocks]() {
bool ignored;
FastRandomContext insecure;
for (int i = 0; i < 1000; i++) {
auto block = blocks[InsecureRandRange(blocks.size() - 1)];
auto block = blocks[insecure.randrange(blocks.size() - 1)];
ProcessNewBlock(Params(), block, true, &ignored);
}
@@ -171,7 +172,9 @@ BOOST_AUTO_TEST_CASE(processnewblock_signals_ordering)
});
}
threads.join_all();
for (auto& t : threads) {
t.join();
}
while (GetMainSignals().CallbacksPending() > 0) {
MilliSleep(100);
}