Skip to content

wip#2

Closed
lorenzolfm wants to merge 1 commit into
masterfrom
feat/wire-multiple-fixed-peers
Closed

wip#2
lorenzolfm wants to merge 1 commit into
masterfrom
feat/wire-multiple-fixed-peers

Conversation

@lorenzolfm

@lorenzolfm lorenzolfm commented May 24, 2026

Copy link
Copy Markdown
Owner

Description and Notes

Generalizes --connect from a single fixed peer to a list, so the node can be pinned to multiple peers at once, mirroring Bitcoin Core's -connect. --connect may now be passed multiple times; when any value is present, the node connects exclusively to those peers and skips all peer-discovery paths.

This closes getfloresta#861, picking up where the previous "Up for grabs" PR getfloresta#873.

Key points:

  • UtreexoNodeConfig.fixed_peer: Option<String>fixed_peers: Vec<String>; resolved NodeCommon.fixed_peerfixed_peers: Vec<LocalAddress>.
  • Resolved peers are deduplicated by (address, port), so passing the same host twice doesn't open duplicate connections.
  • create_connection selects the first not-yet-connected fixed peer. A failed attempt is now logged at debug and retried on the next maintenance tick rather than silently dropped or aborting the reconnect loop.
  • can_start_headers_sync begins sync once all fixed peers are connected, or after a grace period with at least one connected peer, so a single dead/unreachable fixed peer can't wedge the node in CreatingConnections forever.

How to verify the changes you have done?

  1. Unit tests: cargo test -p floresta-wire — 31 pass.
  2. Compilation: cargo check -p floresta-wire -p floresta-node -p florestad — no warnings.
  3. CLI: florestad --connect 127.0.0.1:8333 --connect 10.0.0.1:8333 connects only to those two peers; passing one of them twice opens a single connection.

@lorenzolfm
lorenzolfm force-pushed the feat/wire-multiple-fixed-peers branch 15 times, most recently from 98efdac to 8a8d9b4 Compare May 30, 2026 10:42
Previously `--connect` accepted a single peer and the node connected only
to it. This generalizes it to a list: `--connect` may be passed multiple
times, and the node connects exclusively to the given peers, mirroring
Bitcoin Core's `-connect` behavior.

- `UtreexoNodeConfig.fixed_peer: Option<String>` becomes
  `fixed_peers: Vec<String>`, and the resolved `NodeCommon.fixed_peer`
  becomes `fixed_peers: Vec<LocalAddress>`.
- Resolved peers are deduplicated by (address, port) so passing the same
  host twice doesn't open duplicate connections.
- `create_connection` picks the first not-yet-connected fixed peer;
  connection failures are logged and retried on the next maintenance tick
  instead of aborting the loop.
- `can_start_headers_sync` starts once every fixed peer is connected, or
  after a grace period with at least one peer connected, so a single dead
  or unreachable fixed peer can't wedge the node in `CreatingConnections`
  forever.
- `--connect` accepts an IPv4/IPv6/hostname address with an optional port.

Closes getfloresta#861

BREAKING CHANGE: `UtreexoNodeConfig::fixed_peer` (`Option<String>`) is
replaced by `fixed_peers` (`Vec<String>`). Callers building the config
manually must update the field name and type.
@lorenzolfm
lorenzolfm force-pushed the feat/wire-multiple-fixed-peers branch from 8a8d9b4 to a47476d Compare May 30, 2026 10:48
@lorenzolfm lorenzolfm closed this May 31, 2026
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.

Allow passing multiple fixed peers

1 participant