Skip to content

Commit

Permalink
Merge pull request #159 from AntelopeIO/GH-139-vote-not-received-main
Browse files Browse the repository at this point in the history
[1.0-beta1 -> main] Vote processing fix
  • Loading branch information
heifner authored May 17, 2024
2 parents c42a611 + 8cb8027 commit 5ababa5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3251,6 +3251,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 @@ -510,7 +510,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));
}
FC_ASSERT(retrys, "Never saw this nodes vote processed before timeout");
}
Expand Down
2 changes: 1 addition & 1 deletion unittests/finality_test_cluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class finality_test_cluster {
// 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

0 comments on commit 5ababa5

Please sign in to comment.