-
Notifications
You must be signed in to change notification settings - Fork 1
fix: add peer detail full address handling #541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR ReviewSummaryThis PR adds handling for connection strings in the full URI format ( ✅ Strengths
🐛 Potential IssuesCritical: IPv6 Address Parsing BugThere's a potential bug with IPv6 addresses in full URI format. The test at line 168-181 tests IPv6 with just The current implementation uses For IPv6 address
Recommendation: Add a test case for the full URI format with IPv6 to verify the 📝 Minor Observations
🔒 SecurityNo security concerns identified. The parsing logic is straightforward and doesn't introduce vulnerabilities. ⚡ PerformanceNo performance concerns. The string operations are simple and efficient. 📋 Next Steps
VerdictGood fix with excellent test coverage! 🎯 Just need to verify the IPv6 edge case before merging. |
|
About Claude comment, there is a Unit test for IPV6 |
|
👏
|
ovitrif
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tAck
Tests
- new wallet > Lightning Node peers 🟢
Fixes the "Invalid socket address" error that occurs when connecting to trusted Lightning peers loaded from Blocktank info.
Description
The
ILspNode.toPeerDetails()extension function was assuming that theconnectionStringsfield contained onlyhost:portformat (e.g.,"34.65.86.104:9400"), but the actual Blocktank API returns the full connection URI in the formatnodeId@host:port(e.g.,"028a8910...@34.65.86.104:9400").When this full connection string was passed directly to LDK's
node.connect()function as the address parameter, it was rejected with "Invalid socket address" because LDK expects only the socket address portion (host:port).Changes:
toPeerDetails()to parse connection strings and extract just thehost:portportion when the full URI format is present"host:port"→ used as-is"nodeId@host:port"→ extracts"host:port"portionPeerDetailsTest.kt) with 16 test cases covering all extension functions and edge casesRoot Cause:
This issue appeared after PR #536 which introduced loading trusted peers from Blocktank info. Previously, peers were loaded from
Env.trustedLnPeerswhich had the correct format. The new code path exposed the format mismatch.Preview
Uploading Screen_recording_20251219_132825.webm…
QA Notes
Tests Added:
PeerDetailsTest.ktall passingManual Testing:
✓ Connected to trusted peer: <nodeId>)./gradlew testDevDebugUnitTest --tests PeerDetailsTestRegression Testing:
PeerDetailsextension functions (parse, from, host, port, uri) continue to work correctly