You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dash-spv: a restart during a committed-filter rescan loses payments to new scripts, and a removed wallet's rescan state is never dropped #1559
The fix for #1348 matches newly derived scripts against filter batches that have already committed. It does this with rescan jobs held in FiltersManager memory. Two gaps remain in that design.
1. A restart during a committed rescan loses the payment
Committed-rescan jobs aren't saved to disk. Suppose the process stops while a job is still working through its range, or after the job requested a block but before the block was applied. On the next start, FiltersManager::new() seeds the wallet's current scripts as covered up to its synced_height, and that includes the newly derived scripts. The job's range is never matched against them again. A payment the job would have found stays missing until a full rescan from the wallet's birth height.
On mainnet the window is short. The job reads committed filters in 5,000-height chunks, one chunk per tick, and then the requested blocks have to arrive. But a crash or a user quitting in that window loses funds visibility with no indication.
Expected: pending committed-rescan jobs survive a restart, or a restart treats scripts derived after the last committed batch as uncovered.
To reproduce:
Commit a batch.
Derive a script that a block inside the committed range pays (for example, with a BlockProcessed that carries the new script).
Drop and recreate the FiltersManager before the job drains.
The paying block is never requested.
2. A removed wallet's rescan state is never dropped
When a wallet is removed, its per-wallet coverage record, its seeded flag and any queued committed-rescan jobs stay in FiltersManager for the life of the process. A job still queued for it goes on to request blocks for a wallet that no longer exists. The leak is small and bounded per removed wallet.
Expected: a wallet's coverage, seeded flag and jobs are dropped once the wallet manager no longer reports it.
Activity