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: the per-tick filter rescan re-applies thousands of already processed blocks #1236
All paths are under dash-spv/src/ at 8dde9d0c (dev after #902).
FiltersManager calls rescan_active_batches from tick (sync/filters/sync_manager.rs:274-275, sync/filters/manager.rs:802-822) whenever new scripts are pending, over up to 16 active batches (MAX_LOOKAHEAD_BATCHES, sync/filters/manager.rs:82, previously 3). Before #902 the rescan ran only once per batch, in reconcile_untested_scripts at commit. The rescans now hit batches whose blocks are still in flight, which drives the InFlight arm of rescan_batch (sync/filters/manager.rs:906-910) and track_for_new_scripts. A block is re-applied when it was already processed but the filters manager has not yet handled its BlockProcessed.
Evidence. The benchmark runs are 12 interleaved full testnet syncs of the #902 head 39eef40d against dev 0dcdd823. The network code is byte-identical to what landed on dev.
Already processed blocks re-applied per run: 1,007 to 8,612 on the refactor, 656 to 770 on dev.
Time in filter rescans per run: about 21 to 145s on the refactor, 3 to 7.5s on dev (upper bound, includes wallet lock waits).
InFlight rescan entries per run: 0 on dev, 1,944 to 10,174 on the refactor.
One block (1450839) was applied 75 times in one run, and 73 of those passes found nothing new.
Final wallet state is identical in all 24 runs (20.66198098 DASH, 3,266 transactions), so this is wasted work, not a correctness bug.
Fix. Rescan only batches whose blocks are all processed, or coalesce the per-tick rescan, and don't emit BlocksNeeded for an in-flight block unless its wallet set grew. The underlying re-track of already processed blocks is #1229.
Activity
fix(dash-spv): skip re-applying blocks on rescan
fix(dash-spv): skip re-applying blocks on rescan
fix(dash-spv): skip re-applying blocks on rescan
fix(dash-spv): skip re-applying blocks on rescan
fix(dash-spv): skip re-applying blocks on rescan
fix(dash-spv): skip re-applying blocks on rescan
fix(dash-spv): skip re-applying blocks on rescan
fix(dash-spv): skip re-applying blocks on rescan
fix(dash-spv): skip re-applying blocks on rescan
fix(dash-spv): skip re-applying blocks on rescan (dashpay#1344)