Skip to content

Commit

Permalink
Backlog scan scanned event
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Nov 25, 2024
1 parent 8f6860b commit 7ae7c8a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions nano/lib/stats_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ enum class detail
activate_failed,
activate_skip,
activate_full,
scanned,

// active
insert,
Expand Down
7 changes: 5 additions & 2 deletions nano/node/backlog_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,15 @@ void nano::backlog_scan::activate (secure::transaction const & transaction, nano
auto const maybe_conf_info = ledger.store.confirmation_height.get (transaction, account);
auto const conf_info = maybe_conf_info.value_or (nano::confirmation_height_info{});

activated_info info{ account, account_info, conf_info };

stats.inc (nano::stat::type::backlog_scan, nano::stat::detail::scanned);
scanned.notify (transaction, info);

// If conf info is empty then it means then it means nothing is confirmed yet
if (conf_info.height < account_info.block_count)
{
stats.inc (nano::stat::type::backlog_scan, nano::stat::detail::activated);

activated_info info{ account, account_info, conf_info };
activated.notify (transaction, info);
}
}
Expand Down
1 change: 1 addition & 0 deletions nano/node/backlog_scan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class backlog_scan final
*/
using callback_t = nano::observer_set<nano::secure::transaction const &, activated_info const &>;
callback_t activated;
callback_t scanned;

private: // Dependencies
backlog_scan_config const & config;
Expand Down

0 comments on commit 7ae7c8a

Please sign in to comment.