Skip to content

Commit

Permalink
Fixing a race condition in active_transactions.fork_replacement_tally (
Browse files Browse the repository at this point in the history
…nanocurrency#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.
  • Loading branch information
dsiganos authored Jan 22, 2024
1 parent 815ac36 commit 06d8b4e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nano/core_test/active_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 06d8b4e

Please sign in to comment.