Skip to content

Commit 109c7ce

Browse files
committed
Terminate block production loop when shutting down witness plugin bitshares#1314
1 parent 49a7fb2 commit 109c7ce

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

libraries/plugins/witness/include/graphene/witness/witness.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class witness_plugin : public graphene::app::plugin {
8484

8585
boost::program_options::variables_map _options;
8686
bool _production_enabled = false;
87+
bool _shutting_down = false;
8788
uint32_t _required_witness_participation = 33 * GRAPHENE_1_PERCENT;
8889
uint32_t _production_skip_flags = graphene::chain::database::skip_nothing;
8990

libraries/plugins/witness/witness.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ void witness_plugin::plugin_startup()
144144
void witness_plugin::plugin_shutdown()
145145
{
146146
// nothing to do
147+
_shutting_down = true;
147148
}
148149

149150
void witness_plugin::refresh_witness_key_cache()
@@ -161,6 +162,8 @@ void witness_plugin::refresh_witness_key_cache()
161162

162163
void witness_plugin::schedule_production_loop()
163164
{
165+
if (_shutting_down) return;
166+
164167
//Schedule for the next second's tick regardless of chain state
165168
// If we would wait less than 50ms, wait for the whole second.
166169
fc::time_point now = fc::time_point::now();

0 commit comments

Comments
 (0)