fix(wire): Dont error when no conections while on regtest.#791
fix(wire): Dont error when no conections while on regtest.#791jaoleal wants to merge 1 commit intogetfloresta:masterfrom
Conversation
|
A little question about regtest mode, since its a "private chain" its not like we need to select a chain, should |
fafc242 to
03f841c
Compare
Maybe we should implement the
Regtest is used to test behavior. We should have more tests in situation where nodes are in different chains. |
...
Since the problem is manly 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()); |

Description and Notes
Regtest doesnt allow do try out external conections but our
chain_selectorkeeps 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
just pcc(recommended but slower)just lint-features '-- -D warnings' && cargo test --releaseFinally, 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).