Skip to content

fix(wire): Dont error when no conections while on regtest.#791

Open
jaoleal wants to merge 1 commit intogetfloresta:masterfrom
jaoleal:dont_tryrandomconections_in_regtest
Open

fix(wire): Dont error when no conections while on regtest.#791
jaoleal wants to merge 1 commit intogetfloresta:masterfrom
jaoleal:dont_tryrandomconections_in_regtest

Conversation

@jaoleal
Copy link
Collaborator

@jaoleal jaoleal commented Jan 18, 2026

Description and Notes

Regtest doesnt allow do try out external conections but our chain_selector keeps trying to open connections and erroring because addrman doesnt have any dns seeds.

This PR fixes that, not having dns seeds and external peers is technically not a error in regtest

How to verify the changes you have done?

run on regtest mode, be sure that you see that we dont fetch any dns seeds.
No errors because of that.

Contributor Checklist

  • I've followed the contribution guidelines
  • I've verified one of the following:
    • Ran just pcc (recommended but slower)
    • Ran just lint-features '-- -D warnings' && cargo test --release
    • Confirmed CI passed on my fork
  • I've linked any related issue(s) in the sections above

Finally, you are encouraged to sign all your commits (it proves authorship and guards against tampering—see How (and why) to sign Git commits and GitHub's guide to signing commits).

@jaoleal
Copy link
Collaborator Author

jaoleal commented Jan 18, 2026

A little question about regtest mode, since its a "private chain" its not like we need to select a chain, should chain_selector jump headers first and go directly to running_node ?

@jaoleal jaoleal force-pushed the dont_tryrandomconections_in_regtest branch from fafc242 to 03f841c Compare January 18, 2026 06:34
@Davidson-Souza Davidson-Souza added the bug Something isn't working label Jan 18, 2026
@Davidson-Souza
Copy link
Member

Regtest doesnt allow do try out external conections but our chain_selector keeps trying to open connections and erroring because addrman doesnt have any dns seeds.

Maybe we should implement the --addnode and --seednode CLI options

A little question about regtest mode, since its a "private chain" its not like we need to select a chain, should chain_selector jump headers first and go directly to running_node ?

Regtest is used to test behavior. We should have more tests in situation where nodes are in different chains.

@jaoleal jaoleal changed the title fix(wire): Dont try external conections while on regtest. fix(wire): Dont error when no conections while on regtest. Jan 23, 2026
@jaoleal
Copy link
Collaborator Author

jaoleal commented Jan 23, 2026

What this pr actually fixes is this bloating my terminal

image

Theoretically is not an error while in regtest

@Davidson-Souza
Copy link
Member

What this pr actually fixes is this bloating my terminal

...

Theoretically is not an error while in regtest

Since the problem is manly NoAddressesAvailable, perhaps we should just make those functions no_log

Cc. @JoseSK999

diff --git a/crates/floresta-wire/src/p2p_wire/node/chain_selector_ctx.rs b/crates/floresta-wire/src/p2p_wire/node/chain_selector_ctx.rs
index 835f060..0cabf9f 100644
--- a/crates/floresta-wire/src/p2p_wire/node/chain_selector_ctx.rs
+++ b/crates/floresta-wire/src/p2p_wire/node/chain_selector_ctx.rs
@@ -820,12 +820,14 @@ where
         periodic_job!(
             self.last_connection => self.maybe_open_connection(ServiceFlags::NONE),
             ChainSelector::TRY_NEW_CONNECTION,
+            no_log,
         );
 
         // Open new feeler connection periodically
         periodic_job!(
             self.last_feeler => self.open_feeler_connection(),
             ChainSelector::FEELER_INTERVAL,
+            no_log,
         );
 
         if let ChainSelectorState::LookingForForks(start) = self.context.state {
diff --git a/crates/floresta-wire/src/p2p_wire/node/mod.rs b/crates/floresta-wire/src/p2p_wire/node/mod.rs
index aa9f2f7..eea481f 100644
--- a/crates/floresta-wire/src/p2p_wire/node/mod.rs
+++ b/crates/floresta-wire/src/p2p_wire/node/mod.rs
@@ -393,7 +393,7 @@ macro_rules! periodic_job {
 
     ($timer:expr => $what:expr, $interval_secs:path,no_log $(,)?) => {{
         if $timer.elapsed() > Duration::from_secs($interval_secs) {
-            $what;
+            let _ = $what;
             $timer = Instant::now();
         }
     }};
diff --git a/crates/floresta-wire/src/p2p_wire/node/running_ctx.rs b/crates/floresta-wire/src/p2p_wire/node/running_ctx.rs
index 87f0079..1e57875 100644
--- a/crates/floresta-wire/src/p2p_wire/node/running_ctx.rs
+++ b/crates/floresta-wire/src/p2p_wire/node/running_ctx.rs
@@ -409,6 +409,7 @@ where
         periodic_job!(
             self.last_connection => self.check_connections(),
             RunningNode::TRY_NEW_CONNECTION,
+            no_log
         );
 
         // Check if some of our peers have timed out a request
@@ -418,6 +419,7 @@ where
         periodic_job!(
             self.last_feeler => self.open_feeler_connection(),
             RunningNode::FEELER_INTERVAL,
+            no_log,
         );
 
         // The jobs below need a connected peer to work
diff --git a/crates/floresta-wire/src/p2p_wire/node/sync_ctx.rs b/crates/floresta-wire/src/p2p_wire/node/sync_ctx.rs
index b43c983..a26eb72 100644
--- a/crates/floresta-wire/src/p2p_wire/node/sync_ctx.rs
+++ b/crates/floresta-wire/src/p2p_wire/node/sync_ctx.rs
@@ -249,12 +249,14 @@ where
         periodic_job!(
             self.last_connection => self.check_connections(),
             SyncNode::TRY_NEW_CONNECTION,
+            no_log,
         );
 
         // Open new feeler connection periodically
         periodic_job!(
             self.last_feeler => self.open_feeler_connection(),
             SyncNode::FEELER_INTERVAL,
+            no_log,
         );
 
         try_and_log!(self.check_for_timeout());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants