Skip to content

key-wallet: islock conflict-sweep and abandon removals emit no events — mirrors keep dead rows, released coins stuck spent #976

Description

@bfoss765

Found by the 2026-08-19 merged-PR audit (mechanics introduced/exposed by #961/#962). Three related defects, all the same engine-vs-store divergence class:

  1. islock conflict-sweep emits no removal event (HIGH): mark_instant_send_utxos discards the WalletConflictSweep result, so when an islock conflicts a wallet transaction the engine sweeps it internally but TransactionsSwept never reaches the FFI event stream. Host persistence mirrors (Kotlin/Swift) keep the dead tx rows, and coins the sweep released stay marked spent forever. This is the normal tx-then-islock ordering, not an edge case.
  2. Released outpoints never restored to core utxos (MED-HIGH): the consumer is told the coins are spendable again while coin selection cannot actually spend them; the restore path is unreachable once the funding tx is chainlocked. (Raised by QE on fix(key-wallet): stop a never-broadcast transaction from crediting money that does not exist #961 thread 2; merged unresolved.)
  3. Abandon path performs removals with no event (MED): same divergence class.

A complete fix exists on branch fix/sweep-event-emission (former PR #971, closed to keep the open-PR queue focused on migration-critical work): events wired through process_instant_send_lock, plus re-credit gated on a chainlock-horizon (spend_proof_horizon) so a re-credited coin can never race an in-flight spend proof. Reopen the PR as-is when there is review bandwidth.

Note: this divergence class overlaps the layer-1 reconcile planned for the restore-persistence bug — it may be simplest for that reconcile to heal it store-side, with this branch as the engine-side complement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions