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 rescan below the wallet birth height restarts the filter scan forever #1542
After a filter rescan that rewinds a wallet below its birth height (the "full rescan from 0" a wallet app offers), the filter scan never finishes. tick restarts it every couple of seconds:
On a mainnet device this ran 3,817 times in 1 h 40 min until the app was closed. The wallet's synced_height stayed at 0, no SyncHeightAdvanced was emitted, and the SPV log grew by about 200 MB. A brand-new mainnet wallet reproduces it in seconds: 73 restarts in the first 13 s after the rescan.
Seen with dash-spv 0.47.0 (f0ddfd45f78e). dash-spv 0.46.0 (aca020263990) does not loop.
Why
Two places compute the lowest height a scan covers, and they disagree:
tick (and start_download) floor the scan at earliest_required_height().max(header start).
try_commit_batches floors the contiguity guard at the header start only.
Since #1161 a checkpoint stores CHECKPOINT_HEADERS (25) headers ending at its height, so the stored chain starts 24 blocks under a wallet born at that checkpoint (mainnet imports default to birth 200000; new wallets are born at the latest checkpoint). With synced_height = 0 the first batch starts at the birth height, the guard sees heights start - 24 .. birth - 1 as an uncovered gap, and refuses to certify. The wallet stays behind, so tick resets the scan again.
A normal sync does not hit it, because the wallet's synced_height already sits at or above its birth height. Relaunching the client stops the loop, but the rescan that was asked for never happens.
Steps to reproduce
Mainnet wallet with birth height equal to a checkpoint height (e.g. 200000 or 2550000), fully synced.
Rewind its synced_height to 0 while SPV runs.
Watch the filter manager restart at the birth height forever.
Activity
chore(wallet): pin platform 7ffa0d2e0c (v5.2-dev) (#1550)