Skip to content

chore: bump ldk-node to 0.7.0-rc.84 - #2197

Merged
ovitrif merged 6 commits into
masterfrom
chore/ldk-node-rc84
Nov 30, 2026
Merged

ovitrif merged 6 commits into
masterfrom
chore/ldk-node-rc84

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • Bumps the version pin and its checksums to 0.7.0-rc.84, so that a panic inside the node returns an error and stops the node instead of ending the app
  • Restarts a node that stopped itself on a start, a return to the foreground, a sync retry or the network coming back, because the app still treated it as running
  • Stops the event loop when a node that is no longer running refuses to mark an event handled, so the same event is not delivered over and over; a running node whose write failed keeps its loop
  • Retries that restart up to five times while the store is still busy with the stopped node's writes, until any stop is requested
  • Nothing polls for a stopped node: an app left open and idle notices it at the next of these triggers

Out of Scope

  • LightningService.kt: the status, channel, peer and balance getters still run outside ServiceQueue, as before

Design

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

  • 1. With the app open and online, stop the native node from a debug hook, then pull to refresh on Home → the node restarts on the sync retry, a later refresh succeeds and it does not keep restarting — stopping the native node is not in Capabilities
  • 2. Stop the native node again, press Home and return → a new node starts in the same process — stopping the native node is not in Capabilities

Automated Checks

  • updated 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 requested
  • updated LightningServiceTest.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 stopped

Evidence

c3c996f78 on an arm64 emulator, regtest dev build plus the debug hook:

  • 1: passed — the node restarted 19 s after the stop, the next refresh succeeded and no restart loop followed in the next minute
  • 2: passed — a new node started in the same process and a later refresh succeeded

Gaps

  • No real panic was triggered: the hook stops the native node, so calls fail as not running, and a node refusing with PersistenceFailed was not exercised on a device
  • The network-return trigger and the refused-event stop are covered by unit tests only
  • The event-loop change and the busy-store retry came after the device run at c3c996f78 and are covered by unit tests only

Models used

  • Planning/scoping: Claude Opus 5.5 (reasoning: medium)
  • Implementation: Claude Opus 5.5 (reasoning: medium), Claude Sonnet 5.5 (reasoning: high)
  • Review: Gemini 4 Neon (reasoning: high)
  • Review rounds: 3

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
@ovitrif ovitrif added this to the 3.3.0 milestone Nov 29, 2026
@ovitrif ovitrif self-assigned this Nov 29, 2026
@ovitrif
ovitrif requested review from a team, ben-kaufman and piotr-iohk and removed request for a team November 29, 2026 14:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T14:51:41.695137Z c3c996f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

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)
@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Updates ldk-node-android to 0.7.0-rc.84 and rebuilds nodes that stopped themselves.

  • The app replaces a Lightning node that stopped itself.
  • The event listener stops when a refused event stays queued.

Acknowledged scope from ovitrif: recovery does not poll while the app is idle. Existing getters outside ServiceQueue remain out of scope.

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]
Loading

Reviews (1) · Last reviewed commit: "fix: launch one restart for a stopped no..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 6ac16d5 (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 talosmachina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: isStartTried is reset in setup and set only in start's finally, covered by the new service test.
  • An app stop counted as a self-stop: stop() clears isStartTried before node.stop(), covered.
  • Two triggers start twice: pendingStartCount.compareAndSet(0, 1) gates the launch, covered.
  • Restart races a background stop: pendingStopJob check plus stopRequestsSeen, 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
@ovitrif
ovitrif requested a review from piotr-iohk November 29, 2026 15:49

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DISCONNECTED followed by CONNECTED and 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.

@ovitrif

ovitrif commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

Merged: approved by @piotr-iohk, checks green, all review threads answered.

@ovitrif
ovitrif merged commit da4e215 into master Nov 30, 2026
23 checks passed
@ovitrif
ovitrif deleted the chore/ldk-node-rc84 branch November 30, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants