fix: dynamic trusted peer IPs from Blocktank API#456
Open
ben-kaufman wants to merge 1 commit intomasterfrom
Open
fix: dynamic trusted peer IPs from Blocktank API#456ben-kaufman wants to merge 1 commit intomasterfrom
ben-kaufman wants to merge 1 commit intomasterfrom
Conversation
77f80dc to
b77c812
Compare
4 tasks
c86c8be to
b77c812
Compare
ovitrif
approved these changes
Feb 22, 2026
Collaborator
ovitrif
left a comment
There was a problem hiding this comment.
utAck
proceeding to test 🧪
ovitrif
approved these changes
Feb 22, 2026
Collaborator
There was a problem hiding this comment.
tAck
Tests
Note: Tests 3 and 4 use the Peer Simulation picker added in #458 (stacked on this PR) to simulate edge cases without modifying code or network conditions.
1. 🟢 Fresh Wallet: new LND4 peer connected instead of old one, trusted peers fetched from api/info
INFOℹ️: Fetched 3 trusted peers from Blocktank API [WalletViewModel.swift: fetchTrustedPeersFromBlocktank() line: 277]
INFOℹ️: Using 3 trusted peers from Blocktank API [LightningService.swift: connectToTrustedPeers(remotePeers:) line: 317]
2. 🟢 Existing install (stale LND4 IP cached)
- Built branch
release-2.0.4& installed app using old version (using commit of last tag) - Loaded old wallet, confirmed it uses old LND4 as one of the 3 trusted peers
- Built this branch & installed app of this branch
- Confirmed IP of LND4 is updated (see imgs)
| Before | After |
|---|---|
![]() |
![]() |
3. 🟢 API unreachable → fallback to env peers
- Used Peer Simulation picker in LDK Debug screen (set to API Failure)
- With wallet loaded, selected it, then restarted Lightning node from LDK Debug screen
- Confirmed fallback to hardcoded env peers:
WARN⚠️ : ⚠️ [DEBUG] Simulating Blocktank API failure [WalletViewModel.swift: fetchTrustedPeersFromBlocktank() line: 247]
WARN⚠️ : No remote peers available, falling back to preconfigured env peers [LightningService.swift: connectToTrustedPeers(remotePeers:) line: 321]
4. 🟢 API peers unreachable → verify + env fallback
- Verified
verifyTrustedPeersOrFallbacklogic handles case where API peers connect but none are reachable - Since env peers and API peers share the same node IDs (LND4), verification correctly logs:
WARN⚠️ : No trusted peers connected. All preconfigured env peers overlap with API peers (not retrying with stale addresses). [LightningService.swift: verifyTrustedPeersOrFallback() line: 350]
- This is correct behavior: avoids retrying with stale hardcoded IPs when the same nodes were already attempted via fresh API addresses
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
This PR:
/infoendpoint at startup, instead of relying solely on hardcoded addresses34.65.186.40to34.65.153.174fix/peer-address-upsertbranch which persists updated peer addresses on connectPreviously, iOS used only hardcoded peer addresses. When LND4's IP changed, the app kept retrying the stale address indefinitely. Android already fetched peers from the Blocktank API — this brings iOS to parity.
The ldk-node fix (synonymdev/ldk-node#53) ensures that even without an app update,
Node::connectwith the new IP will persist the updated address and the reconnection loop will use it going forward.Linked Issues/Tasks
Screenshot / Video
N/A — no UI changes, peer connection logic only.
QA Notes
1. Fresh install
2. Existing install (stale LND4 IP cached)
3. API unreachable
4. API returns unreachable peers
Made with Cursor