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

Prs/fix unittests active transactions.inactive votes cache election start #4409

Closed
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/active_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@ TEST (active_transactions, inactive_votes_cache_election_start)
node.vote_processor.vote (vote0, std::make_shared<nano::transport::inproc::channel> (node, node));
ASSERT_TIMELY_EQ (5s, 0, node.active.size ());
ASSERT_TIMELY_EQ (5s, 5, node.ledger.cache.cemented_count);
ASSERT_TRUE (nano::test::confirmed (node, { send1, send2, open1, open2 }));
ASSERT_TIMELY (1s, nano::test::confirmed (node, { send1, send2, open1, open2 }));

// A late block arrival also checks the inactive votes cache
ASSERT_TRUE (node.active.empty ());
ASSERT_TIMELY (1s, node.active.empty ());
auto send4_cache (node.vote_cache.find (send4->hash ()));
ASSERT_TRUE (send4_cache);
ASSERT_EQ (3, send4_cache->voters ().size ());
Expand Down
2 changes: 2 additions & 0 deletions nano/node/active_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ void nano::active_transactions::stop ()

void nano::active_transactions::block_cemented_callback (std::shared_ptr<nano::block> const & block_a)
{
//There is a race between execution of block_cemented_callback and void nano::scheduler::priority::run ()
std::this_thread::sleep_for (10ms);
auto transaction = node.store.tx_begin_read ();
auto status_type = election_status (transaction, block_a);

Expand Down
Loading