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

Reduce likelyhood of race in node.fork_publish #4804

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions nano/core_test/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,13 @@ TEST (node, fork_publish)
.build ();
node1.work_generate_blocking (*send2);
node1.process_active (send1);
node1.process_active (send2);
ASSERT_TIMELY_EQ (5s, 1, node1.active.size ());
ASSERT_TIMELY (5s, node1.active.active (*send2));
auto election (node1.active.election (send1->qualified_root ()));
ASSERT_NE (nullptr, election);
// Wait until the genesis rep activated & makes vote
ASSERT_TIMELY_EQ (1s, election->votes ().size (), 2);
node1.process_active (send2);
ASSERT_TIMELY (5s, node1.active.active (*send2));
auto votes1 (election->votes ());
auto existing1 (votes1.find (nano::dev::genesis_key.pub));
ASSERT_NE (votes1.end (), existing1);
Expand Down
4 changes: 2 additions & 2 deletions nano/test_common/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ namespace test
/** Generate work with difficulty between \p min_difficulty_a (inclusive) and \p max_difficulty_a (exclusive) */
uint64_t work_generate_limited (nano::block_hash const & root_a, uint64_t min_difficulty_a, uint64_t max_difficulty_a);
/**
* Polls, sleep if there's no work to be done (default 50ms), then check the deadline
* Polls, sleep if there's no work to be done (default 10ms), then check the deadline
* @returns 0 or nano::deadline_expired
*/
std::error_code poll (std::chrono::nanoseconds const & sleep_time = std::chrono::milliseconds (50));
std::error_code poll (std::chrono::nanoseconds const & sleep_time = std::chrono::milliseconds (10));
std::error_code poll_until_true (std::chrono::nanoseconds deadline, std::function<bool ()>);
void delay_ms (std::chrono::milliseconds const & delay);
void deadline_set (std::chrono::duration<double, std::nano> const & delta);
Expand Down
Loading