Skip to content

bug: early or post-restart hold failures keep the swap polled #1927

Closed

Description

@ovitrif

Two hold failures still leave a swap saved in unfinishedPubkySwaps, so it's advanced every 30 s on each node start until bitkit-core reports it failed (about 144 blocks).

Why

  • Hold fails before payInvoice returns: proceedWithSwapRoutedPayment (AppViewModel.kt) skips pendingPaymentRepo.track, so the failure event never reaches releaseFailedSwapHold. The LightningPaymentFailedError branch of finishSwapRoutedPayment only clears swapIdsByHoldHash. On Main.immediate, the async in awaitSwapClaim that would call awaitClaim is cancelled before it starts, so the repo never sees the failure either.
  • Hold fails after an app restart: swapIdsByHoldHash lives only in memory, so a resumed swap whose hold then fails is never dropped.

No funds are at risk: each advance loads the mnemonic and opens an Electrum connection. The swap route is behind the debug-only PUBKY_SWAPS_ROUTES flag.

Fix

  • Call dropFailedSwap in the LightningPaymentFailedError branch of finishSwapRoutedPayment.
  • Persist the hold hash with the unfinished swap, so a hold failure after a restart drops it.

Found in review of #1923: #1923 (review)

Activity

  1. added this to the 3.3.0 milestone on Nov 14, 2026
  2. self-assigned this
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions