Skip to content

Commit

Permalink
Terminate block production loop when shutting down witness plugin #1314
Browse files Browse the repository at this point in the history
  • Loading branch information
cogutvalera committed Oct 3, 2018
1 parent 49a7fb2 commit 109c7ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class witness_plugin : public graphene::app::plugin {

boost::program_options::variables_map _options;
bool _production_enabled = false;
bool _shutting_down = false;
uint32_t _required_witness_participation = 33 * GRAPHENE_1_PERCENT;
uint32_t _production_skip_flags = graphene::chain::database::skip_nothing;

Expand Down
3 changes: 3 additions & 0 deletions libraries/plugins/witness/witness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ void witness_plugin::plugin_startup()
void witness_plugin::plugin_shutdown()
{
// nothing to do
_shutting_down = true;
}

void witness_plugin::refresh_witness_key_cache()
Expand All @@ -161,6 +162,8 @@ void witness_plugin::refresh_witness_key_cache()

void witness_plugin::schedule_production_loop()
{
if (_shutting_down) return;

//Schedule for the next second's tick regardless of chain state
// If we would wait less than 50ms, wait for the whole second.
fc::time_point now = fc::time_point::now();
Expand Down

0 comments on commit 109c7ce

Please sign in to comment.