Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions dash-spv/src/sync/filters/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ pub(super) struct FiltersBatch {
/// need rescan, attributed per wallet so we can rerun matching only
/// against the wallet that produced each new script.
collected_scripts: HashMap<WalletId, HashSet<ScriptBuf>>,
/// The manager's script-derivation generation observed the last time
/// this batch's filters were matched against the wallets' FULL script
/// sets (the initial scan, or a commit-time verification rescan).
///
/// Commit compares this against the current generation to decide
/// whether a verification rescan is still needed: scripts derived from
/// blocks owned by OTHER batches never land in this batch's
/// `collected_scripts`, so "no collected scripts left" alone does not
/// prove this batch has nothing more to match.
full_match_generation: u64,
}

impl FiltersBatch {
Expand All @@ -56,6 +66,7 @@ impl FiltersBatch {
rescan_complete: false,
scanned_wallets: BTreeMap::new(),
collected_scripts: HashMap::new(),
full_match_generation: 0,
}
}
/// Start height of this batch (inclusive).
Expand Down Expand Up @@ -107,6 +118,14 @@ impl FiltersBatch {
pub(super) fn rescan_complete(&self) -> bool {
self.rescan_complete
}
/// The script-derivation generation at this batch's last full-set match.
pub(super) fn full_match_generation(&self) -> u64 {
self.full_match_generation
}
/// Record the script-derivation generation this batch was fully matched at.
pub(super) fn set_full_match_generation(&mut self, generation: u64) {
self.full_match_generation = generation;
}
/// Mark rescan as complete for this batch.
pub(super) fn mark_rescan_complete(&mut self) {
self.rescan_complete = true;
Expand Down
Loading
Loading