Skip to content

Commit

Permalink
GH-986 Add option to shutdown after swap
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Nov 25, 2024
1 parent 6a57eda commit 426cfc6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class read_write {
chain::name to;
fc::crypto::private_key trx_priv_key;
fc::crypto::private_key blk_priv_key;
bool shutdown = false; // shutdown node before next block
};
empty swap_action(const swap_action_params& params) const;

Expand Down Expand Up @@ -79,4 +80,4 @@ class test_control_plugin : public plugin<test_control_plugin> {
FC_REFLECT(eosio::test_control_apis::empty, )
FC_REFLECT(eosio::test_control_apis::read_write::kill_node_on_producer_params, (producer)(where_in_sequence)(based_on_lib) )
FC_REFLECT(eosio::test_control_apis::read_write::throw_on_params, (signal)(exception) )
FC_REFLECT(eosio::test_control_apis::read_write::swap_action_params, (from)(to)(trx_priv_key)(blk_priv_key) )
FC_REFLECT(eosio::test_control_apis::read_write::swap_action_params, (from)(to)(trx_priv_key)(blk_priv_key)(shutdown) )
2 changes: 2 additions & 0 deletions plugins/test_control_plugin/test_control_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ void test_control_plugin_impl::swap_action_in_block(const chain::signed_block_pt
ilog("Swapped action ${f} to ${t}, add_result ${a}, block ${bn}",
("f", _swap_on_options.from)("t", _swap_on_options.to)("a", add_result)("bn", bh ? bh->block_num() : 0));
app().find_plugin<net_plugin>()->broadcast_block(copy_b, copy_b->calculate_id());
if (_swap_on_options.shutdown)
app().quit();
reset_swap_action();
}

Expand Down

0 comments on commit 426cfc6

Please sign in to comment.