Cleaning up initialization of bulk_pull_client.
This commit is contained in:
parent
d36093af55
commit
a1432635d0
2 changed files with 27 additions and 11 deletions
|
|
@ -19,12 +19,9 @@ nano::pull_info::pull_info (nano::hash_or_account const & account_or_head_a, nan
|
||||||
}
|
}
|
||||||
|
|
||||||
nano::bulk_pull_client::bulk_pull_client (std::shared_ptr<nano::bootstrap_client> const & connection_a, std::shared_ptr<nano::bootstrap_attempt> const & attempt_a, nano::pull_info const & pull_a) :
|
nano::bulk_pull_client::bulk_pull_client (std::shared_ptr<nano::bootstrap_client> const & connection_a, std::shared_ptr<nano::bootstrap_attempt> const & attempt_a, nano::pull_info const & pull_a) :
|
||||||
connection (connection_a),
|
connection{ connection_a },
|
||||||
attempt (attempt_a),
|
attempt{ attempt_a },
|
||||||
known_account{},
|
pull{ pull_a }
|
||||||
pull (pull_a),
|
|
||||||
pull_blocks (0),
|
|
||||||
unexpected_count (0)
|
|
||||||
{
|
{
|
||||||
attempt->condition.notify_all ();
|
attempt->condition.notify_all ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,31 @@ public:
|
||||||
nano::block_hash first ();
|
nano::block_hash first ();
|
||||||
std::shared_ptr<nano::bootstrap_client> connection;
|
std::shared_ptr<nano::bootstrap_client> connection;
|
||||||
std::shared_ptr<nano::bootstrap_attempt> attempt;
|
std::shared_ptr<nano::bootstrap_attempt> attempt;
|
||||||
nano::block_hash expected;
|
|
||||||
nano::account known_account;
|
|
||||||
nano::pull_info pull;
|
|
||||||
uint64_t pull_blocks;
|
|
||||||
uint64_t unexpected_count;
|
|
||||||
bool network_error{ false };
|
bool network_error{ false };
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Tracks the next block expected to be received starting with the block hash that was expected and followed by previous blocks for this account chain
|
||||||
|
*/
|
||||||
|
nano::block_hash expected{ 0 };
|
||||||
|
/**
|
||||||
|
* Tracks the account number for this account chain
|
||||||
|
* Used when an account chain has a mix between state blocks and legacy blocks which do not encode the account number in the block
|
||||||
|
* 0 if the account is unknown
|
||||||
|
*/
|
||||||
|
nano::account known_account{ 0 };
|
||||||
|
/**
|
||||||
|
* Original pull request
|
||||||
|
*/
|
||||||
|
nano::pull_info pull;
|
||||||
|
/**
|
||||||
|
* Tracks the number of blocks successfully deserialized
|
||||||
|
*/
|
||||||
|
uint64_t pull_blocks{ 0 };
|
||||||
|
/**
|
||||||
|
* Tracks the number of times an unexpected block was received
|
||||||
|
*/
|
||||||
|
uint64_t unexpected_count{ 0 };
|
||||||
};
|
};
|
||||||
class bootstrap_attempt_wallet;
|
class bootstrap_attempt_wallet;
|
||||||
class bulk_pull_account_client final : public std::enable_shared_from_this<nano::bulk_pull_account_client>
|
class bulk_pull_account_client final : public std::enable_shared_from_this<nano::bulk_pull_account_client>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue