Skip to content

netsync: allow sync with non localhost peers#2487

Merged
Roasbeef merged 2 commits intobtcsuite:masterfrom
Abdulkbk:allow-ip-regtest
Mar 25, 2026
Merged

netsync: allow sync with non localhost peers#2487
Roasbeef merged 2 commits intobtcsuite:masterfrom
Abdulkbk:allow-ip-regtest

Conversation

@Abdulkbk
Copy link
Copy Markdown
Contributor

Change Description

In regtest mode, isSyncCandidate rejects any peer whose address is neither 127.0.0.1 nor localhost. This makes IBD impossible when nodes run in separate Docker containers, because each container receives a bridge network IP (e.g. 172.18.0.x). The sync manager never selects a sync peer, so the node remains at genesis regardless of how many peers are connected.

Copy link
Copy Markdown
Collaborator

@saubyk saubyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept Ack

Abdulkbk and others added 2 commits March 23, 2026 21:13
In this commit, we remove the localhost-only restriction for sync peer
candidates on regtest and simnet. Previously, isSyncCandidate rejected
any regtest peer not on 127.0.0.1 or localhost, which prevented IBD
when nodes run in Docker containers on bridge networks (e.g. 172.18.0.x).

We also replace fragile pointer-equality checks against global chaincfg
params with value-based Name field comparisons, and extend the exception
to simnet since it has the same local-only usage pattern.
Add a test verifying that isSyncCandidate accepts peers from any
address on regtest, including Docker bridge IPs, remote IPs, and IPv6.
Copy link
Copy Markdown
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🦾

@Roasbeef Roasbeef merged commit 6b04a0b into btcsuite:master Mar 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants