Repository navigation
chore: bump ldk-node to 0.7.0-rc.84 - #2197
Conversation
rc.84 unwinds on a panic instead of aborting: the node stops itself and cannot start again. A start, the sync retry and a returning network replace such a node, and the event listener stops instead of redelivering an event the node can no longer mark handled. Verified: testDevDebugUnitTest, detekt, assembleDevDebug
A node the app is stopping or already starting is no longer taken for one that stopped itself. Verified: gradlew testDevDebugUnitTest detekt assembleDevDebug lintDevDebug
Two triggers at once could each launch a start. Verified: gradlew testDevDebugUnitTest detekt assembleDevDebug lintDevDebug
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Verified: none (file rename only)
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryUpdates
Acknowledged scope from Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Start, sync retry, or network returns] --> B{Previously started node stopped?}
B -->|No| C[Continue normal flow]
B -->|Yes| D{Stop pending or start in flight?}
D -->|Yes| E[Leave existing work in charge]
D -->|No| F[Check stop requests under lifecycle lock]
F --> G[Stop and release old node]
G --> H[Build and start replacement]
Reviews (1) · Last reviewed commit: "fix: launch one restart for a stopped no..." · Reviewed by Greptile |
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: full PR diff against its merge base, at 5489368.
1 actionable finding — resolve or provide an evidence-backed rebuttal.
A self-stopped node is rebuilt once. If that build or start fails, the lifecycle becomes ErrorStarting, and pull-to-refresh, the sync retry, and a network reconnect no longer start it. Leaving the app and returning does, because foreground ON_START calls start(). A busy VSS store can fail that return the same way: a setup failure does not use the five-attempt busy-store retry this file already uses for a config-change rebuild.
Device testing was not performed in this review. The author reports manual cases 1 and 2 passed at c3c996f78 on an arm64 emulator with a debug stop() hook; that run did not fail the rebuild or raise a real panic. LightningRepoTest covers a restart that succeeds, a second trigger while one is in flight, and a pending background stop. It does not cover a failed setup. Unit tests were not run here. A dev APK was built from this head in run 46275047601.
Compared only the recovery contract with bitkit-ios#1550 at 4427c18. iOS restarts a node in .errorStarting when the network returns. No matching Android issue was found. Codex and Greptile reported no findings on c3c996f78, before the changelog-only commit.
Suggested additional test case: on a regtest dev build, stop the native node and force the replacement setup to fail once with a busy VSS store (KvStoreSetupFailed). Stay in the foreground and pull to refresh again. The node should be started again without leaving the app.
Findings
- [MEDIUM] Retry a failed rebuild of a self-stopped node — inline at
app/src/main/java/to/bitkit/repositories/LightningRepo.kt:321.
Reviewer model: grok-4.7
Reasoning effort: xhigh
talosmachina
left a comment
There was a problem hiding this comment.
1 finding (1 P2). Bumps ldk-node to 0.7.0-rc.84 (panics unwind and fail-stop the node) and replaces a node that stopped itself on start, sync retry and network return. Reviewed 5489368596ef913f86924ff3ce41add4190ea2a2, full tier, static: Bitkit Android branches are not built here, so this is reasoned from the code, the ldk-node rc.84 source and CI.
What I checked, and 4 candidates I ruled out
Read in full: the diff; LightningRepo.startNode, restartStoppedNode, dropStoppedNode, stopLocked, observeConnectivityForSyncRetry, startSyncRetryLoopIfNeeded, skipStartForRunningNode; LightningService.start, stop, setup, startEventListener, listenForEvents, hasStoppedNode; ldk-node rc.84 Node::start, event_handled, spawn_panic_guard, src/panic.rs, EventQueue.
CI: build-and-test, lint, detekt, build-local green; e2e and compose-ui still running.
Ruled out
- A freshly built node counts as stopped:
isStartTriedis reset insetupand set only instart'sfinally, covered by the new service test. - An app stop counted as a self-stop:
stop()clearsisStartTriedbeforenode.stop(), covered. - Two triggers start twice:
pendingStartCount.compareAndSet(0, 1)gates the launch, covered. - Restart races a background stop:
pendingStopJobcheck plusstopRequestsSeen, covered.
Merge confidence: 4/5, one P2 on a narrow trigger (an event-queue write that fails while a duplicate event is queued).
Reviewer model: Claude Opus 5.5 (claude-opus-5-5)
Reasoning effort: Not exposed (the runtime does not report it to the reviewer)
The loop stops only when the node also is not running, and restarting a stopped node retries while its store is busy. Verified: gradlew testDevDebugUnitTest detekt assembleDevDebug lintDevDebug
Verified: gradlew testDevDebugUnitTest detekt
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: changes since 54893685, including the busy-store restart retry and the event-listener stop condition, at 6ac16d5b. Baseline: previous review.
No new actionable code findings.
Inherited coverage is the ldk-node 0.7.0-rc.84 pin and Gradle verification checksums, and the changelog fragment.
The five busy-store attempts run when the network returns or a sync retry finds a node that stopped itself. A requested or debounced stop ends further attempts. A direct start, including the return to the foreground, still uses that start's single retry. The listener stops when a refused event is still first in the queue and the node is not running. In ldk-node 0.7.0-rc.84, a panic makes event_handled fail before the event is removed; a failed write on a running node removes it first. Android attaches this listener after node.start() returns. Compared with bitkit-ios#1550 at 063426f4, only that event-loop contract and the busy-store retry: iOS also keeps the loop for a running node, and requires that start was attempted on that node because its loop runs before start returns. This was not a full review of the iOS pull request.
Device testing: not performed in this review. The author's device evidence is at c3c996f78, before these commits. The busy-store retry and the running-node event loop are covered by the updated unit tests, which were inspected and not executed here.
Earlier findings reconciled at this revision: 2 verified fixed.
Reviewer model: grok-4.7
Reasoning effort: xhigh
piotr-iohk
left a comment
There was a problem hiding this comment.
Android regtest device QA — PASS on 6ac16d5b24d2d49c1284fd88c649794036ee5546 with LDK 0.7.0-rc.84 (ARM64 emulator, Android 13).
- Home refresh. Stopped the native Lightning node with the PR’s regtest-only debug hook. Pull-to-refresh reached the sync retry, which started a different native node in the same app process. A second refresh completed Lightning wallet sync.
- Return to the foreground. Stopped the replacement, pressed Home, and reopened Bitkit. A new native node started in the same process, the next refresh synced, and the replacement was still running 63 seconds later without a restart loop.
- Network return. Disabled connectivity in the emulator, stopped the native node, then restored connectivity with Bitkit still in the foreground. The app logged
DISCONNECTEDfollowed byCONNECTEDand restarted the node in the same app process.
A real panic, a native PersistenceFailed event refusal, and contention on the VSS store remain unverified on device.
|
Merged: approved by @piotr-iohk, checks green, all review threads answered. |
Twin: synonymdev/bitkit-ios#1550
Source: self, synonymdev/ldk-node#145
This PR bumps ldk-node to 0.7.0-rc.84 and restarts a Lightning node that stops itself after an internal panic.
Description
Out of Scope
LightningService.kt: the status, channel, peer and balance getters still run outsideServiceQueue, as beforeDesign
N/A — no UI changes.
Preview
N/A — no user-visible changes.
QA Notes
Setup
A regtest dev build with a wallet. A panic cannot be triggered from the app, so the manual cases need an uncommitted debug hook that calls the native node's
stop()behind the app's back.Journeys
N/A — not drivable; see Manual Tests.
Manual Tests
Automated Checks
LightningRepoTest.kt— a start, a sync retry and a returning network restart a node that stopped itself, and a busy store is retried until a stop is requestedLightningServiceTest.kt— the listener stops on a refused event, still delivers one that left the queue, keeps running when an equal event follows on a running node, and only a started node counts as stoppedEvidence
c3c996f78on an arm64 emulator, regtest dev build plus the debug hook:Gaps
PersistenceFailedwas not exercised on a devicec3c996f78and are covered by unit tests onlyModels used
Claude Opus 5.5(reasoning:medium)Claude Opus 5.5(reasoning:medium),Claude Sonnet 5.5(reasoning:high)Gemini 4 Neon(reasoning:high)