feat: add network graph reset to recovery - #600
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a82c16990a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryThis PR ports the Android "Reset Network Graph" recovery action to iOS, giving users a manual way to clear a decayed LDK network graph that causes "route not found" failures without reinstalling the app.
Confidence Score: 5/5The change is non-destructive to funds and follows the established wipe/restart pattern; the new button is gated behind wallet existence and a confirmation dialog. The core flow — stop node, delete local graph, delete VSS entry, restart — is logically correct for all normal node states. The shared clearNetworkGraph() helper is a clean extraction with no new logic. SecondaryButtonView correctly gates double-taps via isLoading. No new correctness issues were found beyond what prior threads already captured. WalletViewModel.swift — the resetNetworkGraph() path through waitForNodeToRun for edge-case lifecycle states was flagged in a prior review thread and is worth verifying before merge.
|
| Filename | Overview |
|---|---|
| Bitkit/ViewModels/WalletViewModel.swift | Extracts clearNetworkGraph() helper and adds resetNetworkGraph() with node-stop logic; waitForNodeToRun does not await an in-flight .stopping state before clearing, which was flagged in a prior thread. |
| Bitkit/Views/Recovery/RecoveryScreen.swift | Adds Reset Network Graph button with confirmation alert, loading state, success/error toasts, and session.bump() restart; button is correctly guarded by locked and walletExists. |
| Bitkit/Components/Button/SecondaryButtonView.swift | Adds isLoading support: shows a ProgressView spinner and hides icon/title while loading, matching PrimaryButtonView behavior. |
| Bitkit/Components/Button/Button.swift | Threads isLoading through to SecondaryButtonView; no logic changes. |
| Bitkit/Views/Settings/LdkDebugScreen.swift | Replaces duplicated VSS + local delete logic with wallet.clearNetworkGraph(); error path now only logs, which matches prior behavior. |
| Bitkit/Services/LightningService.swift | Adds hasNode computed property so callers can check node existence without a blocking LDK call. |
| Bitkit/Resources/Localization/en.lproj/Localizable.strings | Adds seven new localisation keys for the Reset Network Graph flow. |
| changelog.d/next/600.fixed.md | Adds changelog entry for the new Reset Network Graph recovery option. |
Reviews (3): Last reviewed commit: "Merge branch 'master' into feat/manual-r..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d3654d3df
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Originally the recovery was added from necessity because we had several issues with the node crashing the app or freezing the UI, and we needed a place to run functions without the node running. Currently it only contains the bare minimum to recover from such a broken state. This feature doesn't seem like it fits in that same category and belongs in either dev settings (the same function is already exposed in Related to that there seems to be some edge cases where the node would indeed also start on |
I created a specific button because I want to investigate further the source of the bug before integrating the wipe to the try again flow. see https://synonymworkspace.slack.com/archives/C0AMQ60FA4R/p1781263588886129 And implemented on recovery screen because I didn't want to make a normal user enable the developer screen |
|
IMHO it's ok to keep it on recovery screen, it does signal intent of recovery for users; which know less about historical reasons. It also warrants less work now because this shape of the solution is already merged in Android. Hope this helps 🙏🏻 |
|
I also know we agreed to a different shape before it got implemented, but that's ok IMHO, ultimate decision is for the author of the changes proposed in PRs. I should've probably signaled the mismatch vs. previous discussions while reviewing the Android PR, that's on me. |
The logic implemented in the view model has a guard for VSS wipe failure. I'll set as draft to reuse the same logic in both places |
I should have make more clear in the description why Implemented as a new button instead of an automated check of inside "try again" flow |
…os into feat/manual-rgs-wipe
|
test after 0092285 Simulator.Screen.Recording.-.iPhone.17.-.2026-06-19.at.10.39.09.movOBS: the node started from an already-empty graph after a earlier recovery resets |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bada900adc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This PR adds a manual "Reset Network Graph" option to the Recovery Mode screen as a safe recovery path for a rare "route not found" issue.
In an observed support case (on the React Native app), a wallet with healthy channels and outbound liquidity could not route payments ("route not found") because its local Lightning network graph had decayed (far fewer channels than a full snapshot). The exact root cause is not yet confirmed — the leading hypothesis is an interaction between LDK pruning stale channels and Rapid Gossip Sync only applying forward deltas without ever re-downloading a full snapshot, but that is not conclusive. The issue appears to be infrequent.
What is clear is that the decayed-graph state breaks routing, and that wiping the cached graph reliably resolves it by forcing a fresh full download. This PR adds that as a manual, low-risk recovery path so support and users can fix an affected wallet without reinstalling, independent of the eventual root-cause fix. This is the iOS port of synonymdev/bitkit-android#1020.
Description
.stopping,.errorStarting, and.startingstates as well — so a node can't survive the restart and re-persist the graph after it's cleared.This is a workaround, not a root-cause fix: it does not change the gossip/pruning behaviour and does not try to detect or auto-trigger the reset.
Linked Issues/Tasks
Ports synonymdev/bitkit-android#1020.
Screenshot / Video
with-wallet.mov
no-wallet.mov
QA Notes
Manual Tests
regression:Recovery with no wallet: Reset Network Graph button is disabled.Automated Checks
xcodebuild(Debug, iPhone 17 simulator) build passes; SwiftFormat reports no changes.