resetSpentToAvailable

abstract suspend fun resetSpentToAvailable(address: String): Int

Reset ALL SPENT UTXOs to AVAILABLE for healing during full resync.

Purpose: Self-healing corrupted UTXO state.

Why reset ALL (including spentByLocalTx=true)? During a FULL resync, we replay ALL transactions from the beginning. The sync will correctly re-mark spent UTXOs as SPENT based on actual blockchain history. So it's safe to reset everything.

This fixes issues where UTXOs were incorrectly marked with spentByLocalTx=true (e.g., old error 115 handling bug).

Flow:

  1. Reset ALL SPENT → AVAILABLE

  2. Full sync replays all transactions

  3. Spending transactions re-mark UTXOs as SPENT (correct)

  4. Unspent UTXOs stay AVAILABLE (healed!)

Return

Number of UTXOs reset

Parameters

address

Owner address