Skip to content

chore: bump breez sdk to 0.28.2 - #1306

Merged
ovitrif merged 7 commits into
feat/breez-spark-lightningfrom
chore/breez-sdk-0.28.2
Nov 12, 2026
Merged

ovitrif merged 7 commits into
feat/breez-spark-lightningfrom
chore/breez-sdk-0.28.2

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Twin: synonymdev/bitkit-android#1881

Description

  • Bumps breez-sdk-spark-swift from 0.28.0 to 0.28.2, the current stable release. From 0.28.0 it brings:
    • breez/spark-sdk#1283: check_recover_funds now returns Redo when a CPFP child's funding was spent by another transaction, instead of Valid. It also asks the chain less per check, and marks a transaction it couldn't read Unverified. The emergency exit's driver already rebuilds a fee chain that lost a race on its own, when the SDK calls it Valid. That fallback stays: with 0.28.2 the SDK reports the case as Redo first, so the fallback should rarely run.
    • The same release marks a step Unverified during a check when one chain read fails, and clears it on the next clean check. The exit driver used to rebuild over any unverified step while nothing was ready to send. A single failed read could then rebuild over a step that was already sent, and could show a funding ask until a clean check withdrew it. The driver now rebuilds only when every unilateral step it can't read was already unverified before the current check. A step one failed read turns unverified holds the rebuild until the next check, the same as a step that is ready to send. A step that stays unread rebuilds at the first check where no other step just turned unverified, once a block at most. When funding for an unverified rebuild's fee ask arrives after a clean check read the step again, the rebuild no longer runs: the ask ends and the funding stays at the address. When the payment confirms on a check that turns a step unverified again, the resume waits for the next check, as the check's own rebuild does, since a clean check before it may have sent that step.
    • After a failed chain request, check_recover_funds returns Valid instead of Done until the latest confirmation is six blocks deep (c5f0198). A finished exit can then take a few more blocks to end while the chain service is flaky. No code change: the driver's Valid branch does nothing once every step is confirmed.
    • breez/spark-sdk#1299: a Lightning send is stored as pending before the SDK waits for it, so listPayments shows it during the wait. Bitkit's Spark sync already treats a listed pending send as in flight, the same as an uncertain retry, so the node keeps holding off. The only visible difference is that the send can appear a little sooner. No code or test change.
    • breez/spark-sdk#1280: a keep-alive timeout on the SDK's chain connection is retried on a new connection within the call's time limit, instead of failing the call. No app code depends on the old failure.
    • The rest is docs, CLI samples, and Cash App bridging that Bitkit doesn't use.

Design

N/A — no UI changes.

Preview

N/A

QA Notes

Automated Checks

  • CI's unit tests and lint run against the new SDK; e2e and the build job are skipped on this PR. Unit tests compiling against the new SDK confirm the API is unchanged for Bitkit's calls.
  • SparkExitTests:
    • testAStepAFailedReadTurnsUnverifiedWaitsForTheNextCheckInsteadOfRebuilding: a ready step that one check turns unverified is neither rebuilt over nor sent, and the exit rebuilds only once the next check still can't read it.
    • testAStepAFailedReadTurnsUnverifiedHoldsTheRebuildOverAnotherUnreadLeaf: one leaf's step was already unread and the other's just turned unverified, and nothing rebuilds.
    • testAFundedUnverifiedAskWhoseStepReadsAgainEndsWithoutARebuild: a paid ask whose step reads ready again sends it and doesn't rebuild.
    • testAFundedUnverifiedAskHoldsItsRebuildOverAStepSentOnAnEarlierCleanCheck: a step sent on a clean check while the payment was unconfirmed is not rebuilt over when the payment is adopted on a tick whose check can't read it.
    • The existing unverified-rebuild tests keep their results.

@ovitrif ovitrif self-assigned this Nov 12, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 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-12T10:53:54.397848Z 82ec599 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.

@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issue was found in the dependency update.

Summary

Updates breez-sdk-spark-swift from 0.28.0 to 0.28.2.

  • Bitkit now uses Breez Spark SDK 0.28.2.

Reviews (1) · Last reviewed commit: "chore: bump breez sdk to 0.28.2" · Reviewed by Greptile

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

No findings. Bumps breez-sdk-spark-swift from 0.28.0 to 0.28.2 in the project pin and Package.resolved. Reviewed 82ec599, full tier (dependency manifest), static: no build, because iOS does not build on this reviewer's Linux host.

What I checked, and 3 candidates I ruled out

Checked: Package.resolved's revision 063f6ad is the commit the upstream 0.28.2 tag points to (git ls-remote), and the pbxproj pin is exactVersion 0.28.2.
Diffed the Swift package, 0.28.0 against 0.28.2: only Package.swift (the xcframework URL and checksum) and breez_sdk_spark.swift changed; the Swift changes are doc comments plus the UniFFI checksums of the two bridgeFromCashApp methods.
CI: SwiftFormat and Greptile green; Run Tests still running at review time

Ruled out

  • An API break in a call Bitkit makes: no public signature changed; the only methods with new checksums are bridgeFromCashApp, and no file under Bitkit/ references Cash App.
  • New RecoveryVerdict or transaction status cases: .redo and .unverified already exist in 0.28.0 and SparkExitDriver already handles both, so checkRecoverFunds returning Redo where it returned Valid lands on an existing branch.
  • Stale FFI module cache: CI builds clean; a local build may need just clean modules (AGENTS.md), and that is not a code defect.

Merge confidence: 4/5, no findings and the binding diff is docs-only for Bitkit's calls, but the unit-test job had not finished when I reviewed.

Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the runtime does not report it)

@ovitrif ovitrif added this to the 3.2.0 milestone Nov 12, 2026
@ovitrif

ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Triage: milestone 3.2.0, as its Android twin synonymdev/bitkit-android#1881. This PR brings Breez SDK fixes the 3.2.0 Spark paths use and closes no issue, so it carries the milestone itself.

@coreyphillips coreyphillips 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.

Two independent reviews, nothing blocking a merge.

worth doing, does not block

  • A failed chain read during a check now triggers the unverified rebuild (Bitkit/Services/SparkExit/SparkExitDriver.swift:871-875). With 0.28.2, one failed chain read during check_recover_funds can make the exit driver rebuild over a step that is still in flight, which the guard in isUnverifiedRebuildDue exists to prevent. In 0.28.0 a check never produced Unverified. status_after_check ended with (None, _) => current, so a Ready step stayed Ready. 0.28.2 (breez/spark-sdk b892ec21) adds this arm ahead of it: rust (None, _) if check.unverified.contains(txid) => ExitTransactionStatus::Unverified, check_exit_chain puts a step that still has to confirm into unverified whenever an outspend query fails for one of its inputs or one of its CPFP child's inputs. Those inputs include the exit's funding. isUnverifiedRebuildDue skips the rebuild only while some unilateral step reads Ready. The comment at :627 gives the reason: a build now would conflict with a step still to send, at the same fee. If a rate-limited chain service flips the only ready step to Unverified, the guard passes. The driver then rebuilds with the same funding inputs over a step it may already have broadcast. If that build hits InsufficientCpfpFunds, it also raises an isUnverifiedAsk fee ask. The user sees that as needs-funding, with its funding reminders, until a clean check withdraws it. 0.28.2 also clears Unverified itself on the next clean check, including one that recover_funds gave. Its guide now says to call check_recover_funds again instead of building again. So this rebuild is no longer needed even for build-time Unverified. I confirmed the SDK side by diffing crates/breez-sdk/core/src/sdk/unilateral_exit.rs and crates/spark-wallet/src/unilateral_exit.rs between the 0.28.0 and 0.28.2 tags, and the app side by reading the driver. I did not reproduce it on regtest. The fakes in SparkExitTests return canned check results, so unit tests cannot show it. One fix: rebuild only over steps that were already Unverified in the stored recovery before this check, and otherwise wait for the next check. The comments at :627 and :1319 that say a rebuild settles an unread step need the same update.

nits

  • Description omits the Done-after-failed-request change in 0.28.2. The description leaves out one more check_recover_funds change in 0.28.2. After a failed chain request, it returns Valid instead of Done until the latest confirmation is six blocks deep (breez/spark-sdk c5f0198f). The driver's .valid branch does nothing when every step is confirmed, so an exit just ends a few blocks later while the chain service is flaky. No code change is needed, but a line in the description would save the next reader from finding it again.

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No new findings. I read the upstream 0.28.0..0.28.2 diff. The pins are consistent: project.pbxproj:1265 is exactVersion 0.28.2, and the Package.resolved revision 063f6ad1… is the 0.28.2 tag.

  • breez/spark-sdk#1299: iOS passes completionTimeoutSecs: nil (SparkManager.swift:367), so listing timing is unchanged. A storage error after dispatch surfaces from sendPayment, which iOS already treats as uncertain unless it's a known pre-dispatch failure. failedSendHashes counts a pending send as live, so there is no double-pay path.

  • breez/spark-sdk#1283: check() and driveWhileFunding both handle .redo. A diverged generation is never rebroadcast, and broadcastReady still never sends an unverified unilateral step. I agree with coreyphillips's note on Unverified reaching isUnverifiedRebuildDue.

  • A lost CPFP race now comes in as .redo instead of .valid + deadCpfpChildren, so three things change:

    • strikes count (:442);
    • Redo rebuilds skip the stall cap;
    • keepValidGeneration doesn't apply.

    I found no route to a second consecutive strike, because the rebuild follows the spent funding. A driver test feeding .redo with a logged isInputSpent refund would pin it. Android synonymdev/bitkit-android#1881 has the same interaction with #1782's driver.

  • The description says CI's e2e runs against the new SDK, but e2e and build are skipped here; only Run Tests (pending) and SwiftFormat run.

Device gate: no device check needed: no UI change. A regtest exit run on 0.28.2 is still worth doing once this branch's exit gate runs again. perf: the check reads the outspend of every input of each unconfirmed step and its child, so more chain requests per tick during an exit. CI: Run Tests pending at 82ec59938.

Reviewer model: Claude Fable 5.2 (claude-fable-5-2), Claude Opus 5.5 (claude-opus-5-5)
Reasoning effort: not exposed

@ovitrif

ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@coreyphillips

A failed chain read during a check now triggers the unverified rebuild

Fixed in 8150b14, the way you suggested. The driver now rebuilds only over a unilateral step that was already Unverified in the stored recovery before this check. A step one failed read turns unverified waits for the next check, which 0.28.2 clears once the read succeeds. The comments above the guard and on broadcastReady now say the same. New test: testAStepAFailedReadTurnsUnverifiedWaitsForTheNextCheckInsteadOfRebuilding.

Description omits the Done-after-failed-request change in 0.28.2

Added to the description.

@jvsena42

A driver test feeding .redo with a logged isInputSpent refund would pin it.

I'm leaving it for the follow-up that decides whether the lost-race fallback stays. That's the change that moves the lost race onto .redo, so the test belongs with it.

The description says CI's e2e runs against the new SDK, but e2e and build are skipped here

Corrected: the description now says only unit tests and lint run on this PR.

The Android twin, synonymdev/bitkit-android#1881, already merged with the same guard. The same fix for Android follows in its own PR into master.

Re-review is needed only because of this push: 82ec599...8150b14

@ovitrif

ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

The Android fix is up in synonymdev/bitkit-android#1886.

@jvsena42 jvsena42 mentioned this pull request Nov 12, 2026
5 of 44 tasks

@coreyphillips coreyphillips 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.

Rechecked after 1 new commit (8150b14). Nothing blocking remains.

addressed

  • Description omits the Done-after-failed-request change in 0.28.2. Fixed: The PR body now has the c5f0198 bullet: Valid instead of Done after a failed chain request, until six blocks deep, with no code change. I checked it with gh pr view 1306.

still open

  • A failed chain read during a check now triggers the unverified rebuild (Bitkit/Services/SparkExit/SparkExitDriver.swift:871-875). With 0.28.2, one failed chain read during check_recover_funds can make the exit driver rebuild over a step that is still in flight, which the guard in isUnverifiedRebuildDue exists to prevent. In 0.28.0 a check never produced Unverified. status_after_check ended with (None, _) => current, so a Ready step stayed Ready. 0.28.2 (breez/spark-sdk b892ec21) adds this arm ahead of it: rust (None, _) if check.unverified.contains(txid) => ExitTransactionStatus::Unverified, check_exit_chain puts a step that still has to confirm into unverified whenever an outspend query fails for one of its inputs or one of its CPFP child's inputs. Those inputs include the exit's funding. isUnverifiedRebuildDue skips the rebuild only while some unilateral step reads Ready. The comment at :627 gives the reason: a build now would conflict with a step still to send, at the same fee. If a rate-limited chain service flips the only ready step to Unverified, the guard passes. The driver then rebuilds with the same funding inputs over a step it may already have broadcast. If that build hits InsufficientCpfpFunds, it also raises an isUnverifiedAsk fee ask. The user sees that as needs-funding, with its funding reminders, until a clean check withdraws it. 0.28.2 also clears Unverified itself on the next clean check, including one that recover_funds gave. Its guide now says to call check_recover_funds again instead of building again. So this rebuild is no longer needed even for build-time Unverified. I confirmed the SDK side by diffing crates/breez-sdk/core/src/sdk/unilateral_exit.rs and crates/spark-wallet/src/unilateral_exit.rs between the 0.28.0 and 0.28.2 tags, and the app side by reading the driver. I did not reproduce it on regtest. The fakes in SparkExitTests return canned check results, so unit tests cannot show it. One fix: rebuild only over steps that were already Unverified in the stored recovery before this check, and otherwise wait for the next check. The comments at :627 and :1319 that say a rebuild settles an unread step need the same update. The single-step case is fixed at SparkExitDriver.swift:880-884, and your new test passes locally. The guard still passes when a different unilateral step was already unread, because unreadBefore only has to match some step. I ran a two-leaf test on a scratch copy (stored n2 unverified, m2 ready; the check returns both unverified). The tick rebuilt to generation 2 over m2, which may already be in the mempool. To close it, also hold the rebuild while any unilateral step is unverified for the first time ($0.status == .unverified && !unreadBefore.contains($0.txid)), alongside the .ready check. The description's "rebuilds only over a step that was already unverified" needs the same correction. Android #1886 has the same shape.

@ovitrif

ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@coreyphillips

The guard still passes when a different unilateral step was already unread

Fixed in bfa6268. The rebuild now needs every unverified unilateral step to have been unverified before this check, so a step this check just turned unverified holds it, as a ready one does. Your two-leaf case is testAStepAFailedReadTurnsUnverifiedHoldsTheRebuildOverAnotherUnreadLeaf. The description is corrected too. The Android twin gets the same change in synonymdev/bitkit-android#1886.

Re-review is needed only because of this push: 8150b14...bfa6268

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-approving at bfa6268a2. 8150b1480 and bfa6268a2 wait one check before rebuilding over a step a single read left unverified, and hold while any step just turned unverified. That matches Android synonymdev/bitkit-android#1886 with the same predicate and tests.

In 0.28.2 a clean check clears Unverified, so a step that stays unread rebuilds one tick later and a flapping step is sent on its clean tick. A third-party spend still arrives as .redo, so nothing can stall for good. The hold returns before the rebuild height is recorded, so no block is lost.

Device gate: no device check needed: no UI change. perf: at most one extra tick before an unverified rebuild.

@coreyphillips coreyphillips 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.

Rechecked after 1 new commit (bfa6268). Nothing blocking remains.

addressed

  • A failed chain read during a check now triggers the unverified rebuild (Bitkit/Services/SparkExit/SparkExitDriver.swift:871-875). Fixed: isUnverifiedRebuildDue at SparkExitDriver.swift:883-884 now passes only if every unverified unilateral step was already unverified in stored, so a step one failed read just flipped holds the rebuild. I traced both new tests against it: in SparkExitTests.swift:1611 and :1647 the old contains rebuilds and the new allSatisfy does not. The comments at :627-630 and :1331-1332 now describe the wait-a-check behaviour. I could not run the suite here because there is no simulator runtime.

new since the last review

worth doing, does not block

  • Funded unverified ask still rebuilds over a step a clean check made ready (Bitkit/Services/SparkExit/SparkExitDriver.swift:147-159). With 0.28.2, the funding resume at SparkExitDriver.swift:147-159 can rebuild over a step that has already been sent again. The trigger is a clean check during an unverified rebuild's fee ask that turns the unread step back to Ready. Here is the path: 1. driveWhileFunding withdraws the ask only when no step is unverified and no savings payment is pending (:307). 2. If the user paid the ask from savings, the ask stays. 3. broadcastReady at :315 sends the step that now reads Ready. 4. When the payment confirms, the tick calls build straight away. Nothing like the isUnverifiedRebuildDue guard runs first. The result is the same-fee conflict that the comment at :627 says the check path avoids. A single failed read on another step can keep the ask open the same way without a pending payment, because :308 counts cooperative steps too. That case also needs the funding to be adopted on that tick. Point 1 found that 0.28.0 never cleared Unverified on a check, so the step could not go out during the ask. The bump is what opens this path. I found this by reading the code only. I did not reproduce it, and I could not run the unit tests here. One possible fix: on resume, skip the build when no unilateral step still reads unverified, or when one reads Ready. Leave the funding at the address, as :306 already does.

@ovitrif

ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@coreyphillips

Funded unverified ask still rebuilds over a step a clean check made ready

Fixed in 0869a9e, the first way you suggested. When funding for an unverified ask arrives, the resume now skips the build if a unilateral step reads Ready or none still reads unverified. It ends the ask instead, and the adopted funding stays for a later rebuild or the leftover sweep. Test: testAFundedUnverifiedAskWhoseStepReadsAgainEndsWithoutARebuild. A savings payment keeps the ask open, the confirming tick's check reads n2 as ready and sends it, and nothing rebuilds. The Android twin is the same, in synonymdev/bitkit-android#1886.

Re-review is needed only because of this push: bfa6268...0869a9e

@coreyphillips coreyphillips 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.

Rechecked after 2 new commits (0869a9e, cf14f5e). Nothing blocking remains.

still open

  • Funded unverified ask still rebuilds over a step a clean check made ready (Bitkit/Services/SparkExit/SparkExitDriver.swift:147-159). With 0.28.2, the funding resume at SparkExitDriver.swift:147-159 can rebuild over a step that has already been sent again. The trigger is a clean check during an unverified rebuild's fee ask that turns the unread step back to Ready. Here is the path: 1. driveWhileFunding withdraws the ask only when no step is unverified and no savings payment is pending (:307). 2. If the user paid the ask from savings, the ask stays. 3. broadcastReady at :315 sends the step that now reads Ready. 4. When the payment confirms, the tick calls build straight away. Nothing like the isUnverifiedRebuildDue guard runs first. The result is the same-fee conflict that the comment at :627 says the check path avoids. A single failed read on another step can keep the ask open the same way without a pending payment, because :308 counts cooperative steps too. That case also needs the funding to be adopted on that tick. Point 1 found that 0.28.0 never cleared Unverified on a check, so the step could not go out during the ask. The bump is what opens this path. I found this by reading the code only. I did not reproduce it, and I could not run the unit tests here. One possible fix: on resume, skip the build when no unilateral step still reads unverified, or when one reads Ready. Leave the funding at the address, as :306 already does. Claude still sees it: The new guard at SparkExitDriver.swift:152-159 covers a clean check on the same tick the payment confirms, and testAFundedUnverifiedAskWhoseStepReadsAgainEndsWithoutARebuild shows that case. It misses a clean check on an earlier tick of the ask. Say the savings payment is still unconfirmed: a clean check reads n2 as Ready and broadcastReady sends it. The ask stays open, because :315 needs fundingPaymentTxid == nil and fundingTopUp adopts only confirmed coins. If one chain read fails on the tick the payment confirms, the in-mempool n2 reads Unverified and no step reads Ready, so :160-165 builds over it at the same fee. The resume needs the clause that isUnverifiedRebuildDue has at :891-893: keep the statuses from before driveWhileFunding's check, and hold while any unread unilateral step was not unread then. I traced this by reading the code. I did not run the tests.

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-approving at cf14f5e77. 0869a9e34 ends a funded unverified ask once its unilateral steps read again, instead of rebuilding over a step about to be sent. The adopted funding stays for a later rebuild or the leftover sweep. This matches Android synonymdev/bitkit-android#1886 (f20441738).

@ovitrif

ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed d594038, the iOS side of a point @coreyphillips raised on synonymdev/bitkit-android#1886 (comment). The funded unverified ask's resume now holds over a step this tick's check just turned unverified, using the recovery from before the check, as the check path's rebuild does. So a step sent on an earlier clean check, while the savings payment was still unconfirmed, is no longer rebuilt over when the payment confirms on a tick whose read fails. New test testAFundedUnverifiedAskHoldsItsRebuildOverAStepSentOnAnEarlierCleanCheck covers the sequence. The description says the same.

Re-review is needed only because of this push: cf14f5e...d594038

@ovitrif

ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

@coreyphillips the still-open point in #1306 (review) is fixed in d594038. The funded resume now keeps the statuses from before driveWhileFunding's check and holds while any unread unilateral step was not unread then, the same clause isUnverifiedRebuildDue has. testAFundedUnverifiedAskHoldsItsRebuildOverAStepSentOnAnEarlierCleanCheck covers your sequence: n2 goes out on a clean check while the payment is unconfirmed, then the payment confirms on a tick whose read of n2 fails, and nothing is rebuilt.

@coreyphillips coreyphillips 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.

Rechecked after 1 new commit (d594038). Nothing blocking remains.

addressed

  • Funded unverified ask still rebuilds over a step a clean check made ready (Bitkit/Services/SparkExit/SparkExitDriver.swift:147-159). Fixed: SparkExitDriver.swift:153 takes the unread set from before.recovery, the stored recovery before driveWhileFunding's check. The branch at :161-163 skips the build when any unread unilateral step was not unread then. This is the same clause as isUnverifiedRebuildDue at :888-900. I traced your sequence through both ticks. On the first tick, a clean check sends n2, and the unconfirmed payment returns early at :133. On the next tick n2 reads unverified again and the payment is adopted. n2 is not in the before-set, so the code reaches :161 instead of build. The cooperative-unverified variant takes the same path: adoption on the same tick ends at the ready guard on :154, and adoption on a later tick holds at :161. One case remains: a sent step that stays unread for two checks in a row is still rebuilt over. The check path does the same, and the description states it. I could not run testAFundedUnverifiedAskHoldsItsRebuildOverAStepSentOnAnEarlierCleanCheck because this machine has only the command-line tools, no Xcode. By reading, without the new branch the second tick reaches build at tip 1001, so the recoverRequests assertion would fail.

new since the last review

nits

  • New hold test never asserts the payment was adopted on the second tick (BitkitTests/SparkExitTests.swift:1871-1875)

Comment thread BitkitTests/SparkExitTests.swift Resolved
@ovitrif

ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed 31f8848, test only: the hold test now asserts the payment was adopted, per @coreyphillips's nit in #1306 (comment).

Re-review is needed only because of this push: d594038...31f8848

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-approving at d5940383c. The funded unverified resume now holds while a step was turned unverified by this check rather than an earlier one (unreadBefore from before.recovery). That matches Android synonymdev/bitkit-android#1886 (45bd7340c) and the check's own rebuild rule. A step that stays unread resumes on the next tick, and nothing new is paid.

@coreyphillips coreyphillips 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.

Rechecked after 1 new commit (31f8848). Nothing blocking remains.

addressed

  • New hold test never asserts the payment was adopted on the second tick (BitkitTests/SparkExitTests.swift:1871-1875). Fixed: BitkitTests/SparkExitTests.swift:1873 now asserts record.funding.contains { $0.txid == paid } after the second tick. On the first tick the payment's UTXO is unconfirmed, and fundingTopUp (SparkExitFunding.swift:449) takes only confirmed coins. The only place a txid enters record.funding is adoptFunding (SparkExitDriver.swift:358), so the assertion fails if adoption fails and the tick returns at the :133 guard. I ran -only-testing:BitkitTests/SparkExitDriverTests at 31f8848 on an iPhone 17e simulator: 84 tests, 0 failures, this test included.

@ovitrif

ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Merging into feat/breez-spark-lightning: @coreyphillips and @jvsena42 approved, unit tests and SwiftFormat pass on 31f8848, and no review thread is open.

@ovitrif
ovitrif merged commit bbf02ca into feat/breez-spark-lightning Nov 12, 2026
11 checks passed
@ovitrif
ovitrif deleted the chore/breez-sdk-0.28.2 branch November 12, 2026 15:01
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.

4 participants