Skip to content

Stop hourly fee re-checks for cross-chain setups that never saved a quote - #10

Merged
Kenbak merged 1 commit into
mainfrom
new/crosschain-fee-recheck
Nov 15, 2026
Merged

Kenbak merged 1 commit into
mainfrom
new/crosschain-fee-recheck

Conversation

@Kenbak

@Kenbak Kenbak commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

Sometimes cross-chain quote setup fails before the quote is saved: provider error, validation failure, or a persist failure. When that happens, the attempt is marked NEEDS_REVIEW and its fee row stays reserved with no deposit address. The buyer is never shown deposit instructions.

reconcile() can't do anything with such a row. With no quote it can only resolve a confirmed invoice as direct. Otherwise it fails at "Quote needs review" before it contacts the provider. The fee worker still picked these rows up and backed off to a 1-hour cap, so it retried them forever. On mainnet, invoice 4f53e474… (created 2026-10-24, expired) has 564 failed checks.

Change

  • Narrower worker query: the selection moves into due_fee_checks(). It now picks up a non-terminal fee row only when its attempt has a saved quote (payload IS NOT NULL) or the invoice is confirmed.
  • Fee rows: none are written or changed. Unquoted rows stay reserved, and their failure counts are left as they are.
  • Review flag: operations::issues() still reports these as setup_review, so /api/health stays degraded until someone reviews them manually.
  • Late confirmation: if a direct ZEC payment later confirms the invoice, the row becomes eligible again and resolve_direct runs as before.
  • Payment logic: billing, fee terms and transactions are untouched. The only change is which rows the worker selects.

Tests

  • New: unquoted_failed_setup_is_not_rechecked_until_invoice_confirms. It checks that:
    • a quoted attempt is still selected;
    • an expired unquoted one is not;
    • the row is unchanged and still shows as setup_review;
    • confirming the invoice makes the row eligible again.
  • cargo test --locked: 137 passed, 3 fixture-only tests ignored.
  • scripts/check-dependency-exposure.py passes, and cargo audit with the current ignores passes.

Not deployed. This does not resolve 4f53e474…, which still needs a decision after review.

…uote

When quote setup fails before the deposit is persisted, the fee row stays
'reserved' and reconcile() can only fail with 'Quote needs review' before
contacting the provider. The worker retried such rows hourly forever
(564 failures on mainnet invoice 4f53e474 since 2026-10-24).

The worker now selects them only once the invoice is confirmed, when
reconcile resolves the direct-ZEC obligation as before. Rows are not
modified and still surface as setup_review in payment operations.
@Kenbak
Kenbak merged commit 00d118f into main Nov 15, 2026
4 checks passed
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.

1 participant