Repository navigation
fix: spark exit redo hold and overlapping sends - #1323
Conversation
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. |
[Medium impact] The changes affect Spark invoice payments and emergency-exit fee reminders. The PR appears safe to merge, with a non-blocking gap in repeated funding notifications. Findings
SummaryThis PR fixes Spark payment retries and Redo exit funding asks.
One non-blocking issue remains: a withdrawn funding alert cannot fire again when the exit later asks for the same amount. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Spark send passes earlier checks] --> B{Another Spark send recorded meanwhile?}
B -->|No| C[Record and submit send]
B -->|Yes| D[Refuse submission and read payments]
D --> E{Listed outcome}
E -->|Paid| F[Return payment hash]
E -->|Failed and no live send| G[Return failure]
E -->|Unknown or another send live| H[Keep pending]
Reviews (1) · Last reviewed commit: "fix: spark exit redo hold and overlappin..." · Reviewed by Greptile |
coreyphillips
left a comment
There was a problem hiding this comment.
Two independent reviews, nothing blocking a merge.
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Withdraws the Redo hold's fee ask once the held funding pays for a build, refuses a second Spark send of one invoice at admission and hands it the first send's outcome, and treats an operator FAILED status as unsent for pre-restore invoices. Reviewed 1ae9f78, full tier, static: bitkit-ios does not build on this Linux host, so nothing was run here.
What I checked, and 5 candidates I ruled out
Read in full: LightningService.send (Spark branch), admitSend, settledRecordedRailSend, isSendLive, attemptsRecorded, channelFreeRailPayments, refuseUnverifiedRestoredInvoice, SparkManager.send and SparkSpends.run, SparkExitDriver.tick funding branch, check Redo verdict, build, askForFunding, holdsRedo, SparkExitManager.tick, isFundingAskWithdrawn, scheduleReminders, SparkExitMath.reminders
Call sites traced: admitSend (Spark and node paths), isFundingAskWithdrawn (one caller, SparkExitManager.tick), holdsRedo (three, isBuilt only on the two post-build ones)
Twin: matches synonymdev/bitkit-android#1898 and #1903 on isRedoAsk and the withdrawal predicate
CI: SwiftFormat, validate, integration tests and build-local green; Run Tests still running when this was posted
Ruled out
- Admission refusal of the first send itself:
recordRailAttemptruns only afteradmitSendpasses, so a send is never refused for its own record;markis read before the checks. - Refused send leaking
railSendsInFlight: the new path callsendRailSendand setsisRailSendEnded, thedeferskips the second call, and the throw before that branch still reaches thedefer. isRefusedAtAdmissioncaught by theChannelFreeRailSendRefusedarm:admitSendthrowsNodeError.DuplicatePayment, so the earlier arm never takes it, andbeforeSubmissionerrors still go throughspends.runbefore the SDK call.- Stale
isRedoAskwideningisFundingAskWithdrawn: it is cleared at the start of the next tick once the phase carries no funding, and the predicate also requiresrecord.funding == previous.funding, so a real top-up never reads as a withdrawal (asserted in the existing hold test). - Re-ask after a withdrawal posting no notification: already raised by Greptile on
SparkExitManager.swift:1586; not repeated here.
Merge confidence: 4/5, no findings, but the static review could not run the new ChannelFreeRailTests and SparkExit* cases and Run Tests had not finished at this head.
Reviewer model: claude-opus-5-5
Reasoning effort: low
|
Merging: approved on this head, required checks green (the unit-test job's earlier failures were four different short timeouts in suites this PR doesn't touch; the rerun passed), no open threads. Greptile's reminder point is tracked in #1324. |
Description
Fixes four Spark follow-ups from the reviews of #1309 and #1312, matching the Android twins (synonymdev/bitkit-android#1898, synonymdev/bitkit-android#1903).
QA Notes
ChannelFreeRailTests,SparkExitTestsandSparkExitReviewTests; each fails when its own fix is reverted.ChannelFreeRailTestsand the offlineSparkExit*test classes pass on an iPhone 17 Pro simulator (iOS 26.5).journeys/send/restored-wallet-pre-restore-invoice.xmlis written but not run on a device yet.