Pushing request_bulk_push_target down to the bootstrap_attempt_legacy class removing abstraction hole.
This commit is contained in:
parent
b36ac8b245
commit
1cc272b1de
6 changed files with 8 additions and 14 deletions
|
|
@ -113,12 +113,6 @@ std::string nano::bootstrap_attempt::mode_text ()
|
|||
return mode_text;
|
||||
}
|
||||
|
||||
bool nano::bootstrap_attempt::request_bulk_push_target (std::pair<nano::block_hash, nano::block_hash> &)
|
||||
{
|
||||
debug_assert (mode == nano::bootstrap_mode::legacy);
|
||||
return true;
|
||||
}
|
||||
|
||||
void nano::bootstrap_attempt::set_start_account (nano::account const &)
|
||||
{
|
||||
debug_assert (mode == nano::bootstrap_mode::legacy);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ public:
|
|||
void pull_finished ();
|
||||
bool should_log ();
|
||||
std::string mode_text ();
|
||||
virtual bool request_bulk_push_target (std::pair<nano::block_hash, nano::block_hash> &);
|
||||
virtual void set_start_account (nano::account const &);
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
#include <nano/node/bootstrap/bootstrap_attempt.hpp>
|
||||
#include <nano/node/bootstrap/bootstrap_bulk_push.hpp>
|
||||
#include <nano/node/bootstrap/bootstrap_legacy.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
#include <nano/node/transport/tcp.hpp>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
nano::bulk_push_client::bulk_push_client (std::shared_ptr<nano::bootstrap_client> const & connection_a, std::shared_ptr<nano::bootstrap_attempt> const & attempt_a) :
|
||||
nano::bulk_push_client::bulk_push_client (std::shared_ptr<nano::bootstrap_client> const & connection_a, std::shared_ptr<nano::bootstrap_attempt_legacy> const & attempt_a) :
|
||||
connection (connection_a),
|
||||
attempt (attempt_a)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace nano
|
||||
{
|
||||
class bootstrap_attempt;
|
||||
class bootstrap_attempt_legacy;
|
||||
class bootstrap_client;
|
||||
|
||||
/**
|
||||
|
|
@ -15,14 +15,14 @@ class bootstrap_client;
|
|||
class bulk_push_client final : public std::enable_shared_from_this<nano::bulk_push_client>
|
||||
{
|
||||
public:
|
||||
explicit bulk_push_client (std::shared_ptr<nano::bootstrap_client> const &, std::shared_ptr<nano::bootstrap_attempt> const &);
|
||||
explicit bulk_push_client (std::shared_ptr<nano::bootstrap_client> const &, std::shared_ptr<nano::bootstrap_attempt_legacy> const &);
|
||||
~bulk_push_client ();
|
||||
void start ();
|
||||
void push ();
|
||||
void push_block (nano::block const &);
|
||||
void send_finished ();
|
||||
std::shared_ptr<nano::bootstrap_client> connection;
|
||||
std::shared_ptr<nano::bootstrap_attempt> attempt;
|
||||
std::shared_ptr<nano::bootstrap_attempt_legacy> attempt;
|
||||
std::promise<bool> promise;
|
||||
std::pair<nano::block_hash, nano::block_hash> current_target;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ void nano::bootstrap_attempt_legacy::request_push (nano::unique_lock<nano::mutex
|
|||
{
|
||||
std::future<bool> future;
|
||||
{
|
||||
auto this_l (shared_from_this ());
|
||||
auto client (std::make_shared<nano::bulk_push_client> (connection_l, this_l));
|
||||
auto this_l = std::dynamic_pointer_cast<nano::bootstrap_attempt_legacy> (shared_from_this ());
|
||||
auto client = std::make_shared<nano::bulk_push_client> (connection_l, this_l);
|
||||
client->start ();
|
||||
push = client;
|
||||
future = client->promise.get_future ();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
void request_push (nano::unique_lock<nano::mutex> &);
|
||||
void add_frontier (nano::pull_info const &);
|
||||
void add_bulk_push_target (nano::block_hash const &, nano::block_hash const &);
|
||||
bool request_bulk_push_target (std::pair<nano::block_hash, nano::block_hash> &) override;
|
||||
bool request_bulk_push_target (std::pair<nano::block_hash, nano::block_hash> &);
|
||||
void set_start_account (nano::account const &) override;
|
||||
void run_start (nano::unique_lock<nano::mutex> &);
|
||||
void get_information (boost::property_tree::ptree &) override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue