Fixing a race condition in active_transactions.fork_replacement_tally (#4385)

I did not check the unit test, just fixing the race condition I see
because the CI failed on the assert where it couldn't find the election.
The election finding needs to be inside an ASSERT_TIMELY.
This commit is contained in:
Dimitrios Siganos 2024-01-22 20:28:24 +07:00 committed by GitHub
commit 06d8b4e7ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -898,11 +898,10 @@ TEST (active_transactions, fork_replacement_tally)
.build_shared ();
node1.process_active (fork);
}
ASSERT_TIMELY (5s, !node1.active.empty ());
// Check overflow of blocks
auto election = node1.active.election (send_last->qualified_root ());
ASSERT_NE (nullptr, election);
std::shared_ptr<nano::election> election;
ASSERT_TIMELY (5s, election = node1.active.election (send_last->qualified_root ()));
ASSERT_TIMELY_EQ (5s, max_blocks, election->blocks ().size ());
// Generate forks with votes to prevent new block insertion to election