This commit is contained in:
Piotr Wójcik 2024-11-28 21:55:36 +01:00
commit 88465ac969
2 changed files with 7 additions and 12 deletions

View file

@ -132,21 +132,10 @@ size_t nano::bounded_backlog::index_size () const
return index.size ();
}
bool nano::bounded_backlog::erase (nano::secure::transaction const & transaction, nano::account const & account)
{
nano::lock_guard<nano::mutex> guard{ mutex };
return index.erase (account);
}
void nano::bounded_backlog::activate (nano::secure::transaction & transaction, nano::account const & account, nano::account_info const & account_info, nano::confirmation_height_info const & conf_info)
{
debug_assert (conf_info.frontier != account_info.head);
auto contains = [this] (nano::block_hash const & hash) {
nano::lock_guard<nano::mutex> guard{ mutex };
return index.contains (hash);
};
// Insert blocks into the index starting from the account head block
auto block = ledger.any.block_get (transaction, account_info.head);
while (block)
@ -420,6 +409,12 @@ void nano::bounded_backlog::run_scan ()
}
}
bool nano::bounded_backlog::contains (nano::block_hash const & hash) const
{
nano::lock_guard<nano::mutex> guard{ mutex };
return index.contains (hash);
}
nano::container_info nano::bounded_backlog::container_info () const
{
nano::lock_guard<nano::mutex> guard{ mutex };

View file

@ -116,6 +116,7 @@ public:
size_t index_size () const;
size_t bucket_threshold () const;
bool contains (nano::block_hash const &) const;
nano::container_info container_info () const;
@ -133,7 +134,6 @@ private: // Dependencies
private:
void activate (nano::secure::transaction &, nano::account const &, nano::account_info const &, nano::confirmation_height_info const &);
void update (nano::secure::transaction const &, nano::block_hash const &);
bool erase (nano::secure::transaction const &, nano::account const &);
bool insert (nano::secure::transaction const &, nano::block const &);
bool predicate () const;