mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
test: Undo thread_local g_insecure_rand_ctx
This commit is contained in:
parent
b545a6e689
commit
fa0d3c4407
3 changed files with 10 additions and 7 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue