From 06d8b4e7ba20af559e1175fc91b396c417608c71 Mon Sep 17 00:00:00 2001 From: Dimitrios Siganos Date: Mon, 22 Jan 2024 20:28:24 +0700 Subject: [PATCH] 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. --- nano/core_test/active_transactions.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nano/core_test/active_transactions.cpp b/nano/core_test/active_transactions.cpp index 3ed7f1f5e7..89623eabc0 100644 --- a/nano/core_test/active_transactions.cpp +++ b/nano/core_test/active_transactions.cpp @@ -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 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