Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timing issue in active_elections.fork_replacement_tally #4802

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion nano/core_test/active_elections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ TEST (active_elections, fork_replacement_tally)
.build ();

// Forks without votes
std::shared_ptr<nano::election> election;
for (auto i (0); i < reps_count; i++)
{
auto fork = builder.make_block ()
Expand All @@ -913,10 +914,15 @@ TEST (active_elections, fork_replacement_tally)
.work (*system.work.generate (latest))
.build ();
node1.process_active (fork);

// Assert election exists on first iteration
if (i == 0)
{
ASSERT_TIMELY (5s, election = node1.active.election (fork->qualified_root ()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be true for every iteration, not just the first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we could make the assert more general for every iteration.

}
}

// Check overflow of blocks
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 ());

Expand Down
Loading