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

[1.0-beta1] Vote processing fix #158

Merged
merged 3 commits into from
May 17, 2024
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
1 change: 1 addition & 0 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3245,6 +3245,7 @@ struct controller_impl {
if( s == controller::block_status::incomplete ) {
forkdb.add( bsp, mark_valid_t::yes, ignore_duplicate_t::no );
emit( accepted_block_header, std::tie(bsp->block, bsp->id()), __FILE__, __LINE__ );
vote_processor.notify_new_block();
} else {
assert(s != controller::block_status::irreversible);
forkdb.mark_valid( bsp );
Expand Down
2 changes: 2 additions & 0 deletions libraries/chain/include/eosio/chain/vote_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ class vote_processor_t {

// called from net threads
void notify_new_block() {
if (stopped)
return;
// would require a mtx lock to check if index is empty, post check to thread_pool
boost::asio::post(thread_pool.get_executor(), [this] {
std::unique_lock g(mtx);
Expand Down
2 changes: 1 addition & 1 deletion libraries/testing/tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ namespace eosio::testing {
// wait for this node's vote to be processed
size_t retrys = 200;
while (!c.node_has_voted_if_finalizer(c.head_block_id()) && --retrys) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(std::chrono::milliseconds(5));
Copy link
Member

Choose a reason for hiding this comment

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

It would be better if retries and the sleep time are defined as constants so that they can be kept consistent in the future. But you don't need to make this change for now.

}
FC_ASSERT(retrys, "Never saw this nodes vote processed before timeout");
}
Expand Down
2 changes: 1 addition & 1 deletion unittests/finality_test_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ eosio::chain::vote_status finality_test_cluster::wait_on_vote(uint32_t connectio
// duplicates are not signaled
size_t retrys = 200;
while ( (last_connection_vote != connection_id) && --retrys) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
if (!duplicate && last_connection_vote != connection_id) {
FC_ASSERT(false, "Never received vote");
Expand Down
Loading