Skip to content

Add disable_reachout flag and move preconfigured peer reachout to network layer#5041

Merged
pwojcikdev merged 3 commits intonanocurrency:developfrom
pwojcikdev:reachout-network-layer
Mar 18, 2026
Merged

Add disable_reachout flag and move preconfigured peer reachout to network layer#5041
pwojcikdev merged 3 commits intonanocurrency:developfrom
pwojcikdev:reachout-network-layer

Conversation

@pwojcikdev
Copy link
Copy Markdown
Contributor

Move preconfigured peer reachout into its own network thread with warmup/normal intervals, add trigger_reachout() for rep_crawler, and a disable_reachout node flag to gate all reachout threads. disable_reachout is useful for test setups with two isolated nodes that shouldn't connect to the wider network.

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

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 with node.network.trigger_reachout() in rep_crawler.
  • Remove node::keepalive* APIs and implement reachout + preconfigured reachout in nano::network (including a dedicated reachout thread and new stats).
  • Add disable_reachout / disable_reachout_preconfigured flags (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.
@pwojcikdev pwojcikdev force-pushed the reachout-network-layer branch from 88aafa6 to 04e8aac Compare March 17, 2026 17:07
@gr0vity-dev-bot
Copy link
Copy Markdown

gr0vity-dev-bot commented Mar 17, 2026

Test Results for Commit 04e8aac

Pull Request 5041: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 119s)
  • 5n4pr_conf_10k_change: PASS (Duration: 131s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 135s)
  • 5n4pr_conf_change_independant: PASS (Duration: 133s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 135s)
  • 5n4pr_conf_send_independant: PASS (Duration: 130s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 115s)
  • 5n4pr_rocks_10k_change: FAIL (Duration: 283s)
  • Log

Last updated: 2026-03-17 19:37:25 UTC

@pwojcikdev pwojcikdev merged commit a04a249 into nanocurrency:develop Mar 18, 2026
28 checks passed
@pwojcikdev pwojcikdev deleted the reachout-network-layer branch March 18, 2026 00:47
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