Skip to content

fix: confirm spark payouts when electrum fails - #1304

Merged
ovitrif merged 1 commit into
feat/breez-spark-lightningfrom
fix/spark-payout-electrum-fallback
Nov 12, 2026
Merged

ovitrif merged 1 commit into
feat/breez-spark-lightningfrom
fix/spark-payout-electrum-fallback

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Twin: synonymdev/bitkit-android#1754

Description

  • A contact withdrawal's activity no longer stays on Confirming when Electrum can't read the payout address. A failed read of the payout address's unspent outputs now falls through to the payout transaction's status on Esplora, the same way a missing output already does. Before, the error skipped that lookup, so with an Electrum server that keeps failing the query, the payout never showed as confirmed.
  • Same fix as the Android twin (b5fa15300). Android's second fix, which re-reads the activity before confirming it, isn't needed here: markOnchainActivityAsConfirmed already reads the activity again when it writes.

Design

N/A — no UI changes.

Preview

N/A — no visible change other than the activity leaving Confirming.

QA Notes

Automated Checks

  • SparkWithdrawalTests.testAPayoutIsConfirmedFromItsTransactionWhenElectrumFails: a payout whose address read fails is confirmed from its transaction's status.
  • The full BitkitTests suite passes on CI on this branch. SwiftFormat 0.64.6 lint is clean.

Not tested

  • No device run: staging it needs an Electrum server that fails the payout address's query. The unit test covers the fallback.

@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:54:07.026842Z 9bfe85f 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9bfe85fb3a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Bitkit/Managers/SparkManager.swift Resolved
@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. This PR fixes contact payouts from Spark, which is 3.2.0 work, and closes no issue, so it carries the milestone itself.

@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Failed Electrum address reads now fall back to the payout transaction’s status on Esplora, just like missing outputs already do.

  • Spark contact payouts can confirm from Esplora when Electrum can't read their address.

Reviews (1) · Last reviewed commit: "fix: confirm a spark payout from its tra..." · 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. A failed Electrum read of a contact payout's address now falls through to the payout transaction's Esplora status, as a missing output already did, so the activity can leave Confirming. Reviewed 9bfe85f, full tier, static: no build, because iOS does not build on this reviewer's Linux host.

What I checked, and 3 candidates I ruled out

Read in full: confirmMinedPayouts and its one caller confirmMinedContactPayouts in SparkManager.swift; the new test and its neighbours in SparkWithdrawalTests.swift
CI: SwiftFormat and Greptile green; Run Tests still running at review time

Ruled out

  • An unmined payout confirmed by the fallback: isMined reads txStatus(...).confirmed and maps a 404 to false, so an empty outputs only confirms what Esplora says is in a block.
  • An Esplora error now swallowed: a throwing isMined still reaches the outer catch, which logs and leaves the activity unconfirmed, the same as before for a missing output.
  • Changelog fragment: the base is feat/breez-spark-lightning, the unreleased Spark feature, so this fixes behaviour no release shipped.

Merge confidence: 4/5, no findings, but the unit-test job had not finished when I reviewed; testAPayoutIsConfirmedFromItsTransactionWhenElectrumFails covers the change.

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

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

@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 findings. A thrown Electrum read now becomes outputs = [] and falls through to Esplora isMined (SparkManager.swift:1639-1646). An unmined payout stays unconfirmed (404 → false), and an Esplora error still leaves the activity alone. Android's second fix isn't needed here: markOnchainActivityAsConfirmed (CoreService.swift:1528) re-reads the activity on the core queue and returns if it's missing or already confirmed. testAPayoutIsConfirmedFromItsTransactionWhenElectrumFails fails on the base.

Device gate: no device check needed: no UI change beyond the activity leaving Confirming; the unit test covers it. perf: one Esplora read per unconfirmed contact payout per refresh while Electrum fails, off the refresh path. CI: Run Tests still pending at 9bfe85fb3.

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

Merging into feat/breez-spark-lightning: approved by @coreyphillips and @jvsena42 on 9bfe85f, required checks green, and the one review thread (changelog) answered and resolved.

@ovitrif
ovitrif merged commit b01a099 into feat/breez-spark-lightning Nov 12, 2026
13 checks passed
@ovitrif
ovitrif deleted the fix/spark-payout-electrum-fallback branch November 12, 2026 11:30
@jvsena42 jvsena42 mentioned this pull request Nov 12, 2026
5 of 44 tasks
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