mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
test: Undo thread_local g_insecure_rand_ctx
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user