Skip to content

Commit

Permalink
Requires api_helper_indexes plugin to start node
Browse files Browse the repository at this point in the history
or start with --ignore-api-helper-indexes-warning.
Don't silently write warning messages to P2P log.
  • Loading branch information
abitmore committed Aug 13, 2019
1 parent 90fd510 commit fa2248f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ database_api_impl::database_api_impl( graphene::chain::database& db, const appli
}
catch( fc::assert_exception& e )
{
wlog( "amount_in_collateral_index not found - please enable api_helper_indexes plugin!" );
amount_in_collateral_index = nullptr;
}
}
Expand Down
14 changes: 12 additions & 2 deletions programs/witness_node/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ int main(int argc, char** argv) {
("version,v", "Display version information")
("plugins", bpo::value<std::string>()
->default_value("witness account_history market_history grouped_orders api_helper_indexes"),
"Space-separated list of plugins to activate");
"Space-separated list of plugins to activate")
("ignore-api-helper-indexes-warning", "Do not exit if api_helper_indexes plugin is not enabled.");

bpo::variables_map options;

Expand All @@ -82,7 +83,8 @@ int main(int argc, char** argv) {
cfg_options.add_options()
("plugins", bpo::value<std::string>()
->default_value("witness account_history market_history grouped_orders api_helper_indexes"),
"Space-separated list of plugins to activate");
"Space-separated list of plugins to activate")
("ignore-api-helper-indexes-warning", "Do not exit if api_helper_indexes plugin is not enabled.");

auto witness_plug = node->register_plugin<witness_plugin::witness_plugin>();
auto debug_witness_plug = node->register_plugin<debug_witness_plugin::debug_witness_plugin>();
Expand Down Expand Up @@ -143,6 +145,14 @@ int main(int argc, char** argv) {
return 1;
}

if( !plugins.count("api_helper_indexes") && !options.count("ignore-api-helper-indexes-warning") )
{
std::cerr << "\nIf this is an API node, please enable api_helper_indexes plugin."
"\nIf this is not an API node, please start with \"--ignore-api-helper-indexes-warning\""
" or enable it in config.ini file.\n\n";
return 1;
}

std::for_each(plugins.begin(), plugins.end(), [node](const std::string& plug) mutable {
if (!plug.empty()) {
node->enable_plugin(plug);
Expand Down

0 comments on commit fa2248f

Please sign in to comment.