Using disk store for blocks instead of memory.
This commit is contained in:
parent
52be0619a9
commit
5762d82d2c
3 changed files with 8 additions and 10 deletions
|
@ -2696,21 +2696,21 @@ void rai::block_path::generate (rai::block_hash const & hash_a)
|
|||
void rai::bulk_pull_client::process_end ()
|
||||
{
|
||||
std::vector <std::unique_ptr <rai::block>> path;
|
||||
while (!blocks.empty ())
|
||||
while (connection->connection->client->store.bootstrap_begin () != connection->connection->client->store.bootstrap_end ())
|
||||
{
|
||||
path.clear ();
|
||||
rai::block_path filler (path, [this] (rai::block_hash const & hash_a)
|
||||
{
|
||||
std::unique_ptr <rai::block> result;
|
||||
auto existing (blocks.find (hash_a));
|
||||
if (existing != blocks.end ())
|
||||
auto block (connection->connection->client->store.bootstrap_get (hash_a));
|
||||
if (block != nullptr)
|
||||
{
|
||||
result = std::move (existing->second);
|
||||
blocks.erase (existing);
|
||||
result = std::move (block);
|
||||
connection->connection->client->store.bootstrap_del (hash_a);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
filler.generate (blocks.begin ()->first);
|
||||
filler.generate (connection->connection->client->store.bootstrap_begin ()->first);
|
||||
while (!path.empty ())
|
||||
{
|
||||
auto process_result (connection->connection->client->processor.process_receive (*path.back ()));
|
||||
|
@ -2742,7 +2742,7 @@ void rai::bulk_pull_client::received_block (boost::system::error_code const & ec
|
|||
if (block != nullptr)
|
||||
{
|
||||
auto hash (block->hash ());
|
||||
blocks [hash] = std::move (block);
|
||||
connection->connection->client->store.bootstrap_put (hash, *block);
|
||||
receive_block ();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -451,7 +451,6 @@ namespace rai {
|
|||
void received_type ();
|
||||
void received_block (boost::system::error_code const &, size_t);
|
||||
void process_end ();
|
||||
std::unordered_map <rai::block_hash, std::unique_ptr <rai::block>> blocks;
|
||||
std::array <uint8_t, 4000> receive_buffer;
|
||||
std::shared_ptr <rai::frontier_req_client> connection;
|
||||
std::unordered_map <rai::account, rai::block_hash>::iterator current;
|
||||
|
|
|
@ -101,9 +101,8 @@ wallet_add_account (new QPushButton ("Create account"))
|
|||
QPalette palette;
|
||||
palette.setColor (QPalette::Text, Qt::black);
|
||||
settings_connect_line->setPalette (palette);
|
||||
settings_bootstrap_button->setEnabled (false);
|
||||
settings_bootstrap_button->setText ("Bootstrapping...");
|
||||
client_m.processor.bootstrap (endpoint, [this] () {settings_bootstrap_button->setText ("Bootstrap"); settings_bootstrap_button->setEnabled (true);});
|
||||
client_m.processor.bootstrap (endpoint);
|
||||
settings_connect_line->clear ();
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue