From 4668e2183aace8e725e4e8eadfddeca176a5fc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Fri, 25 Jul 2025 20:27:42 +0200 Subject: [PATCH] Fix `active_elections.vote_replays` test (#4934) --- nano/core_test/active_elections.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nano/core_test/active_elections.cpp b/nano/core_test/active_elections.cpp index 119cd9612..ac6e95ba3 100644 --- a/nano/core_test/active_elections.cpp +++ b/nano/core_test/active_elections.cpp @@ -678,11 +678,15 @@ TEST (active_elections, vote_replays) ASSERT_TRUE (nano::test::start_elections (system, node, { send1, open1 })); ASSERT_EQ (2, node.active.size ()); - // First vote is not a replay and confirms the election, second vote should be a replay since the election has confirmed but not yet removed - auto vote_send1 = nano::test::make_final_vote (nano::dev::genesis_key, { send1 }); + // First vote is not a replay and should not confirm the election, second vote should be a replay + auto vote_send1 = nano::test::make_vote (nano::dev::genesis_key, { send1 }, 0, 0); ASSERT_EQ (nano::vote_code::vote, node.vote_router.vote (vote_send1).at (send1->hash ())); ASSERT_EQ (nano::vote_code::replay, node.vote_router.vote (vote_send1).at (send1->hash ())); + // Now send a final vote to actually confirm the election + auto final_vote_send1 = nano::test::make_final_vote (nano::dev::genesis_key, { send1 }); + node.vote_router.vote (final_vote_send1); + // Wait until the election is removed, at which point the vote is considered late since it's been recently confirmed ASSERT_TIMELY_EQ (5s, node.active.size (), 1); ASSERT_EQ (nano::vote_code::late, node.vote_router.vote (vote_send1).at (send1->hash ()));