Skip to content

Commit

Permalink
fix potential source of problem with some witness_tests
Browse files Browse the repository at this point in the history
When initially chosen witness happened to be first in next schedule, it would produce despite change in set of witnesses represented by witness plugin (and the block
would be ok, because all witnesses have the same key in those tests). The problem could show in tests where it is expected that most blocks are produced from test
manually with debug plugin.
  • Loading branch information
ABW committed Oct 29, 2024
1 parent 03de18e commit e40ef95
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/plugins/witness/witness_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,12 @@ bool witness_plugin::is_fast_confirm_enabled() const
void witness_plugin::set_witnesses( const std::set< hive::protocol::account_name_type >& witnesses )
{
my->_witnesses = witnesses;
// recompute next block production data with new set of witnesses
{
auto data = my->get_produce_block_data( my->_db.get_slot_time( 1 ) );
std::unique_lock g( my->should_produce_block_mutex );
my->produce_block_data = std::move( data );
}
}

void witness_plugin::set_program_options(
Expand Down

0 comments on commit e40ef95

Please sign in to comment.