Add Monero node ping with latency and auto-select#9336
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds Monero node auto-selection at startup: ChangesMonero Node Auto-Select and Ping UI
Sequence Diagram(s)sequenceDiagram
participant App
participant MoneroNodeManager
participant AdapterFactory
participant WalletManager
rect rgba(255, 165, 0, 0.5)
Note over App,WalletManager: Startup auto-select flow
end
App->>MoneroNodeManager: autoSelectFastestNodeOnStartup()
MoneroNodeManager->>MoneroNodeManager: pingNodes(allConfiguredNodes)
MoneroNodeManager->>MoneroNodeManager: persist(fastestNode) [in finally]
MoneroNodeManager-->>MoneroNodeManager: isResolvingFastestNode = false
App->>WalletManager: refreshActiveWallets()
WalletManager->>AdapterFactory: notifyActiveWallets() triggers getAdapter()
AdapterFactory->>MoneroNodeManager: isResolvingFastestNode? false
AdapterFactory-->>WalletManager: MoneroAdapter.create(currentNode)
sequenceDiagram
participant MoneroNetworkViewModel
participant MoneroNodeManager
participant MoneroKitPing
MoneroNetworkViewModel->>MoneroNetworkViewModel: pingNodes() — set all Loading, cancel prior job
MoneroNetworkViewModel->>MoneroNodeManager: pingNodes(serialized list)
MoneroNodeManager->>MoneroKitPing: MoneroKit.pingNodes(...)
MoneroKitPing-->>MoneroNodeManager: NodePingResult[]
MoneroNodeManager-->>MoneroNetworkViewModel: results
MoneroNetworkViewModel->>MoneroNetworkViewModel: map to PingState.Reachable/Unreachable
alt autoSelectEnabled
MoneroNetworkViewModel->>MoneroNetworkViewModel: selectFastestNode()
MoneroNetworkViewModel->>MoneroNodeManager: save(fastestNode)
end
MoneroNetworkViewModel->>MoneroNetworkViewModel: emit updated UI state
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Show per-node response time / Unreachable on the Monero network page via MoneroKit.pingNodes, with a Refresh action. - Add Auto-Select switch that uses the fastest reachable node and disables manual selection while enabled. - Auto-select the fastest node at app startup; defer Monero adapter creation until it resolves so the wallet connects once (no reconnect churn), without delaying other blockchains. - Scope cleartext to default node domains in network security config. - Drop unreachable monerodevs and boldsuck default nodes.
#9291
Summary by CodeRabbit
New Features
Bug Fixes