Skip to content

fix(engine): correct UTXO-mode scans (real confirmations + ownership context) - #33

Merged
LORDBABUINO merged 2 commits into
mainfrom
fix/utxo-mode-correctness
Sep 8, 2026
Merged

fix(engine): correct UTXO-mode scans (real confirmations + ownership context)#33
LORDBABUINO merged 2 commits into
mainfrom
fix/utxo-mode-correctness

Conversation

@LORDBABUINO

Copy link
Copy Markdown
Collaborator

UTXO-mode scans (ScanTarget::Utxos, the txid:vout input path) had two correctness gaps found during the scantxoutset evaluation. Neither the CLI nor the API had any integration test covering this path until now.

  1. Confirmations were hardcoded to zero, so the UTXO-age detectors (age spread, dormant) were effectively blind on this path. They now come from the fetched parent transaction.

  2. The scan only knew the addresses of the UTXOs handed to it, so a user's own batch payment read as an exchange withdrawal (and dust escalated as an attack) because the engine could not tell the user was the sender. EngineSettings gains ownership_descriptors: descriptors or xpubs whose derived addresses seed is_ours(), suppressing the exchange-origin and dust-attack false positives on the user's own sends. The CLI accepts --utxos combined with --descriptors, and the API accepts a utxos + descriptors body, treating the descriptors as ownership context rather than a separate scan target.

Tests: first integration tests for ScanTarget::Utxos on regtest — age spread with real confirmations, and the own-batch false positive asserted both with and without ownership context (the test documents that the FP fires without context and is suppressed with it). Full workspace suite green, clippy -D warnings clean. Test-first throughout.

🤖 Generated with Claude Code

UTXO-mode scans hardcoded confirmations to zero, blinding the age
detectors, and recognized only the scanned outputs' own addresses,
so a user's own batch payment read as an exchange withdrawal.

- confirmations now come from the fetched parent transaction
- EngineSettings gains ownership_descriptors: descriptors (or xpubs)
  whose derived addresses seed is_ours(), suppressing the
  exchange-origin and dust-attack false positives on the user's own
  sends

First integration tests covering ScanTarget::Utxos: age spread with
real confirmations, and the own-batch false positive with and
without ownership context.
--utxos may now be combined with --descriptors, and the API accepts
utxos plus descriptors in one body: the descriptors act as ownership
context for the UTXO scan instead of a separate scan target.
@LORDBABUINO
LORDBABUINO merged commit 28d0d14 into main Sep 8, 2026
3 checks passed
@LORDBABUINO
LORDBABUINO deleted the fix/utxo-mode-correctness branch September 8, 2026 06:59
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