Skip to content

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

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

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

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

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 pinned version in the Xcode project and Package.resolved 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 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
  • Nothing polls for a stopped node: an app left open and idle notices it at the next of these triggers

Out of Scope

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, send the app to the background and return → the log shows the wallet start being retried, the node starts again in the same process and does not keep restarting — stopping the native node is not in Capabilities

Automated Checks

  • updated WalletViewModelWipeTests.swift — a start replaces a node that stopped itself, and only such a node is marked stopped
  • ran WalletWipeAfterFailedStartIntegrationTests.swift — a wipe after a failed start still completes

Evidence

49303a3d3 on a simulator, regtest debug build plus the debug hook:

  • 1: passed — the wallet start was retried, the node started again in the same process and did not restart again

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 was not run on a device
  • The refused-event stop and the stopped-node check inside LightningService have no unit test, as both need a real node
  • The event-loop change came after the device run at 49303a3d3 and was not re-run on a device

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, a return to the foreground and a returning network replace such a node, and the event loop stops instead of redelivering an event the node can no longer mark handled.

Verified: WalletViewModelWipeTests, LightningServiceTests, NodeStartRetryTests, WalletWipeAfterFailedStartIntegrationTests, swiftformat --lint on the changed files
A node the app is stopping is no longer taken for one that stopped itself.

Verified: swiftformat lint, xcodebuild tests WalletViewModelWipeTests, LightningServiceTests, NodeStartRetryTests, WalletWipeAfterFailedStartIntegrationTests
No start or stop runs between the mark and the node status, and a pending restart never counts as a stopped node.

Verified: swiftformat, xcodebuild tests WalletViewModelWipeTests, LightningServiceTests, NodeStartRetryTests, WalletWipeAfterFailedStartIntegrationTests
A stop or restart can begin while the status is read.

Verified: swiftformat, xcodebuild tests WalletViewModelWipeTests, LightningServiceTests, NodeStartRetryTests, WalletWipeAfterFailedStartIntegrationTests
@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:50
@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:59.954468Z 49303a3 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

Confidence Score: 4/5 · The PR appears safe to merge, with a non-blocking test cleanup issue.RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect recovery and event handling for the wallet’s Lightning node.

The PR appears safe to merge, with a non-blocking test cleanup issue.

Findings

  1. P2 Test changes saved wallet values ▶

Summary

Updates ldk-node to 0.7.0-rc.84 and adds recovery for a node that stops itself.

  • The wallet retries a Lightning node that stops itself.
  • The event loop stops when the node keeps refusing the same event.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Start, foreground, or network return] --> B{Started node stopped itself?}
    B -->|No| C[Keep current lifecycle]
    B -->|Yes| D[Mark wallet node stopped]
    D --> E[Request wallet start when online]
    E --> F[Release stopped node]
    F --> G[Build and start replacement]
Loading

Reviews (1) · Last reviewed commit: "fix: re-read the stopped node mark after..." · Reviewed by Greptile

Verified: swiftformat lint, xcodebuild tests WalletViewModelWipeTests

@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 and discards a node that stopped itself before the next setup, on start, foreground return and network return. Reviewed 1f69f49b1d561511659c9591f59895c4462e4382, full tier, static: iOS does not build on Linux, so this is reasoned from the code, the ldk-node rc.84 source and CI, and nothing was run.

What I checked, and 4 candidates I ruled out

Read in full: the diff; LightningService.restart, stopNode(only:), releaseAfterFailedStop, stoppedNode, discardStoppedNode, listenForEvents; WalletViewModel.startNode, markNodeStoppedIfItStoppedItself; the AppScene foreground and network handlers; NodeRestarter; ldk-node rc.84 Node::start, event_handled, the panic guard.
CI: SwiftFormat, validate and Run Tests still running at this head; the previous head's SwiftFormat and validate passed. 1f69f49 only adds snapshotAppDefaultsDomain() to the new test, which answers Greptile's P2.

Ruled out

  • A restart's node discarded mid-restart: stoppedNode rechecks pendingRestarts == 0 and the configured node after the queue read.
  • An app stop read as a self-stop: startTriedNode is cleared on the LDK queue before node.stop() and restored only on a failed stop.
  • Foreground marks a node stopped while starting: hasStoppedNodeWhileUp re-reads the state after each await, covered by testOnlyANodeThatStoppedItselfIsMarkedStopped.
  • Network return double-restarts: NodeRestarter.restart goes through wallet.start, whose state switch refuses .starting.

Merge confidence: 4/5, one P2 on a narrow trigger, and CI has not finished at this head.

Reviewer model: Claude Opus 5.5 (claude-opus-5-5)
Reasoning effort: Not exposed (the runtime does not report it to the reviewer)

Comment thread Bitkit/Services/LightningService.swift Resolved
A failed write removes the event, so an equal next event no longer ends the loop while the node runs.

Verified: swiftformat lint, xcodebuild tests WalletViewModelWipeTests, LightningServiceTests

@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 1f69f49.

1 actionable finding — resolve or provide an evidence-backed rebuttal.

A failed event-queue write can stop the Lightning listener while the node is still running, so later payment and channel events are not delivered until the app process starts again. The same mechanism is already described in the open thread. A VSS put retries for 30 seconds per attempt and up to 180 seconds in total, which overlaps this app's 10-second on-chain sync, so a second identical SyncCompleted is queued while the failed write is in flight. The panic path still refuses event_handled before removing the event and clears is_running; foreground, network, and start recovery still apply to a node that has actually stopped.

Compared bitkit-android#2197 at 54893685 for the shared listener-stop and self-stop restart contracts only, not a full review. That listener uses the same equality check. iOS restarts a self-stopped node when the scene becomes active, when the network returns, and on the next wallet start. An app left open does not poll, which this PR states.

The preferences snapshot requested on the test thread is present in testAStartReplacesANodeThatStoppedItself at this head. No matching issue was found for this listener stop. No unit tests or device run were executed in this review. The author reports manual case 1 passed on 49303a3d3; the two later commits rename the changelog fragment and snapshot test preferences.

Device testing: not performed in this review.

Suggested additional test cases

  • iOS, regtest wallet online. Queue two identical on-chain SyncCompleted events and fail the event-queue write while status().isRunning stays true. Expected: the log does not show "Event loop stopping", and a later payment or channel event still updates the app.
  • iOS, same debug hook as manual case 1. Stop the native node, disconnect the network, then reconnect. Expected: the wallet start is retried once, the node runs in the same process, and it does not restart again.

Limitation: 1 earlier attempt left no retained output, so its findings could not be reconciled.

Findings

  • [MEDIUM] Keep the event loop running after a failed event write — inline at Bitkit/Services/LightningService.swift:3096.

Reviewer model: grok-4.7
Reasoning effort: xhigh

Comment thread Bitkit/Services/LightningService.swift Resolved
A node whose start has not returned is not running either.

Verified: swiftformat lint, xcodebuild tests WalletViewModelWipeTests, LightningServiceTests
@ovitrif
ovitrif requested a review from piotr-iohk November 29, 2026 15:38

@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 1f69f49, including the event-loop stop path, at 063426f. Baseline: review on 1f69f49. Inherited from that baseline: the ldk-node pin bump to 0.7.0-rc.84, self-stopped node detection and discard, WalletViewModel start, foreground and network restart triggers, WalletViewModelWipeTests, and changelog fragment 1550.fixed.md.

1 actionable finding — resolve or provide an evidence-backed rebuttal.

The follow-up stops the event loop after a failed eventHandled() when that event is still first, startTriedNode is this node, and status().isRunning is false. In ldk-node v0.7.0-rc.84, a recorded panic makes event_handled return before the event is removed, and a failed queue write removes the event first, so an equal event can follow. startTriedNode is set in the defer after node.start() returns, which keeps a start that has not returned off the stop path. This is source analysis; this review did not run the unit tests.

The event-listener stop was compared with bitkit-android#2197 at 54893685. Android stops when the next event compares equal. Only that contract was checked, not a full review of the Android pull request.

Device testing: not performed in this review.

Suggested additional test cases:

  • iOS: cover the updated stop decision. When eventHandled() fails and the next event compares equal, stop before delivery when start was tried on that node and it is not running. A running node, and a node whose start() has not returned, keep the loop and deliver the following event.

Earlier findings reconciled at this revision: 1 still present, 1 verified fixed.

Findings

  • [LOW] Snapshot host preferences in the successful start test — inline at BitkitTests/WalletViewModelWipeTests.swift:315. Still present from an earlier unpublished review.

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.

iOS regtest device QA — PASS on 063426f40eb5e23e51654e97d3c6af556c58097a with LDK 0.7.0-rc.84 (iPhone 17 simulator, iOS 27.2).

  • Stopped the native Lightning node while Bitkit was online using the PR’s regtest-only debug hook. Sent Bitkit to the background, then reopened it. The app retried wallet startup, started a different native node in the same process, and completed Lightning wallet sync.
  • The same replacement node was still running 67 seconds later and the logs showed no additional startup.

The run covered stopped-node foreground recovery. A real panic, a native PersistenceFailed event refusal, and a simulator network-return trigger 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 2310812 into master Nov 30, 2026
22 checks passed
@ovitrif
ovitrif deleted the chore/ldk-node-rc84 branch November 30, 2026 10:03
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