Skip to content

Replace wallets periodic reps scan with dedicated thread#5009

Merged
pwojcikdev merged 3 commits intonanocurrency:developfrom
pwojcikdev:wallet-use-threads
Jan 25, 2026
Merged

Replace wallets periodic reps scan with dedicated thread#5009
pwojcikdev merged 3 commits intonanocurrency:developfrom
pwojcikdev:wallet-use-threads

Conversation

@pwojcikdev
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves the periodic wallet representative scan from the generic wallet worker pool to a dedicated named thread, and adds stats instrumentation for the scan loop.

Changes:

  • Extend nano::wallets to depend on nano::stats, add a dedicated reps_thread and reps_condition, and implement run_reps_scan() as a background loop instead of ongoing_compute_reps() scheduled on the worker pool.
  • Wire the new stats dependency through nano::node, and add a new wallet stats type plus loop_reps detail for tracking scan iterations.
  • Update thread role enums/mappings to add wallet_reps and move wallet-related roles to the newer section; update tests to construct wallets with node.stats.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
nano/node/wallet.hpp Adds nano::stats & dependency, declares run_reps_scan(), and introduces reps_condition and reps_thread for the dedicated reps scan thread.
nano/node/wallet.cpp Includes stats, guards delayed work precaching with wallets.stopped, wires stats into wallets ctor, starts/join a wallet_reps thread in start()/stop(), and replaces ongoing_compute_reps() with the run_reps_scan() loop that calls compute_reps() and increments wallet/loop_reps.
nano/node/node.cpp Updates wallets_impl construction to pass stats into the wallets constructor.
nano/lib/thread_roles.hpp Reorganizes thread role enum entries, moving wallet-related roles near the bottom and adding a new wallet_reps role.
nano/lib/thread_roles.cpp Updates get_string switch to match the new enum layout and adds the string mapping for wallet_reps.
nano/lib/stats_enums.hpp Adds stat::type::wallet and stat::detail::loop_reps for wallet-related stats accounting.
nano/core_test/wallets.cpp Adjusts the make_wallets helper to construct wallets with the new node.stats parameter, keeping tests aligned with the constructor signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gr0vity-dev-bot
Copy link
Copy Markdown

gr0vity-dev-bot commented Jan 24, 2026

Test Results for Commit 0d4fe82

Pull Request 5009: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 102s)
  • 5n4pr_conf_10k_change: PASS (Duration: 205s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 136s)
  • 5n4pr_conf_change_independant: PASS (Duration: 135s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 124s)
  • 5n4pr_conf_send_independant: PASS (Duration: 128s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 116s)
  • 5n4pr_rocks_10k_change: FAIL (Duration: 270s)
  • Log

Last updated: 2026-01-25 14:18:47 UTC

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pwojcikdev pwojcikdev merged commit 39254bf into nanocurrency:develop Jan 25, 2026
37 of 38 checks passed
@pwojcikdev pwojcikdev deleted the wallet-use-threads branch January 26, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants