Add disable_reachout flag and move preconfigured peer reachout to network layer#5041
Merged
pwojcikdev merged 3 commits intonanocurrency:developfrom Mar 18, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Moves “preconfigured peer reachout” out of node into network, adds a trigger_reachout() hook for rep_crawler, and introduces node flags to disable reachout behavior (primarily for isolated test setups).
Changes:
- Replace
node.keepalive_preconfigured()usage withnode.network.trigger_reachout()inrep_crawler. - Remove
node::keepalive*APIs and implement reachout + preconfigured reachout innano::network(including a dedicated reachout thread and new stats). - Add
disable_reachout/disable_reachout_preconfiguredflags (CLI + config flags) and add interval reset support with tests.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| nano/node/repcrawler.cpp | Uses network.trigger_reachout() instead of node-level preconfigured keepalive. |
| nano/node/nodeconfig.hpp | Adds new node flags: disable_reachout and disable_reachout_preconfigured. |
| nano/node/node.hpp | Removes keepalive / keepalive_preconfigured declarations from node. |
| nano/node/node.cpp | Removes implementations of node::keepalive and node::keepalive_preconfigured. |
| nano/node/network.hpp | Adds reachout/preconfigured reachout API and a dedicated preconfigured reachout thread state. |
| nano/node/network.cpp | Starts/stops the new thread; implements preconfigured reachout loop, trigger hook, and reachout resolver logic. |
| nano/node/json_handler.cpp | Routes RPC keepalive action to node.network.reachout(). |
| nano/node/cli.cpp | Exposes new reachout-disabling flags via CLI and wires them into node_flags. |
| nano/lib/stats_enums.hpp | Adds new network stat details for preconfigured reachout loop + trigger. |
| nano/lib/interval.hpp | Adds reset() to interval and interval_mt. |
| nano/lib/constants.hpp | Adds timing constants for preconfigured reachout warmup/normal intervals. |
| nano/core_test/utility.cpp | Adds unit tests for interval::reset() and interval_mt::reset(). |
| nano/core_test/network.cpp | Adds a test intended to validate reachout disabling behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+283
to
+304
| resolver.async_resolve (boost::asio::ip::tcp::resolver::query (address_a, std::to_string (port_a)), [this, node_l, address_a, port_a] (boost::system::error_code const & ec, boost::asio::ip::tcp::resolver::iterator i_a) { | ||
| if (!ec) | ||
| { | ||
| for (auto i (i_a), n (boost::asio::ip::tcp::resolver::iterator{}); i != n; ++i) | ||
| { | ||
| auto endpoint (nano::transport::map_endpoint_to_v6 (i->endpoint ())); | ||
| auto channel (find_channel (endpoint)); | ||
| if (!channel) | ||
| { | ||
| tcp_channels.start_tcp (endpoint); | ||
| } | ||
| else | ||
| { | ||
| send_keepalive (channel); | ||
| } | ||
| } | ||
| } | ||
| else | ||
| { | ||
| node.logger.error (nano::log::type::network, "Error resolving address for reachout: {}:{} ({})", address_a, port_a, ec.message ()); | ||
| } | ||
| }); |
Extract keepalive/keepalive_preconfigured from node into network as reachout/reachout_preconfigured with a dedicated periodic thread. The rep_crawler now triggers immediate reachout via interval reset when representative weight is insufficient. Add interval::reset() to support this pattern.
88aafa6 to
04e8aac
Compare
Test Results for Commit 04e8aacPull Request 5041: Results Test Case Results
Last updated: 2026-03-17 19:37:25 UTC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move preconfigured peer reachout into its own network thread with warmup/normal intervals, add
trigger_reachout()for rep_crawler, and adisable_reachoutnode flag to gate all reachout threads.disable_reachoutis useful for test setups with two isolated nodes that shouldn't connect to the wider network.