Skip to content

Commit

Permalink
Simplifying bootstrap_attempt::mode_text and returning the direct cha…
Browse files Browse the repository at this point in the history
…r const * instead of converting it to std::string. (#3869)
  • Loading branch information
clemahieu authored Jul 21, 2022
1 parent f9d9b75 commit 7d20328
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
22 changes: 9 additions & 13 deletions nano/node/bootstrap/bootstrap_attempt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,18 @@ void nano::bootstrap_attempt::stop ()
node->bootstrap_initiator.connections->clear_pulls (incremental_id);
}

std::string nano::bootstrap_attempt::mode_text ()
char const * nano::bootstrap_attempt::mode_text ()
{
std::string mode_text;
if (mode == nano::bootstrap_mode::legacy)
switch (mode)
{
mode_text = "legacy";
case nano::bootstrap_mode::legacy:
return "legacy";
case nano::bootstrap_mode::lazy:
return "lazy";
case nano::bootstrap_mode::wallet_lazy:
return "wallet_lazy";
}
else if (mode == nano::bootstrap_mode::lazy)
{
mode_text = "lazy";
}
else if (mode == nano::bootstrap_mode::wallet_lazy)
{
mode_text = "wallet_lazy";
}
return mode_text;
return "unknown";
}

bool nano::bootstrap_attempt::process_block (std::shared_ptr<nano::block> const & block_a, nano::account const & known_account_a, uint64_t pull_blocks_processed, nano::bulk_pull::count_t max_blocks, bool block_expected, unsigned retry_limit)
Expand Down
2 changes: 1 addition & 1 deletion nano/node/bootstrap/bootstrap_attempt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class bootstrap_attempt : public std::enable_shared_from_this<bootstrap_attempt>
void pull_started ();
void pull_finished ();
bool should_log ();
std::string mode_text ();
char const * mode_text ();
virtual bool process_block (std::shared_ptr<nano::block> const &, nano::account const &, uint64_t, nano::bulk_pull::count_t, bool, unsigned);
virtual void get_information (boost::property_tree::ptree &) = 0;
virtual void block_processed (nano::transaction const & tx, nano::process_return const & result, nano::block const & block);
Expand Down

0 comments on commit 7d20328

Please # to comment.