Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions dash-spv/src/sync/filters/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ impl FiltersBatch {
pub(super) fn filters_mut(&mut self) -> &mut HashMap<FilterMatchKey, BlockFilter> {
&mut self.filters
}
/// Take the loaded filters out of this batch, leaving it empty. Used at
/// commit to move a committed batch's filters into the manager's retained
/// committed-filter set without cloning.
pub(super) fn take_filters(&mut self) -> HashMap<FilterMatchKey, BlockFilter> {
std::mem::take(&mut self.filters)
}
/// Returns whether this batch is verified (filters verified against their headers).
pub(super) fn verified(&self) -> bool {
self.verified
Expand Down
8 changes: 8 additions & 0 deletions dash-spv/src/sync/filters/block_match_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ impl BlockMatchTracker {
self.blocks_remaining.is_empty() && self.processed_blocks_per_wallet.is_empty()
}

/// True while any matched block is still awaiting its `BlockProcessed`.
/// Used to hold off `FiltersSyncComplete` while a committed-range re-open
/// (issue #846) has a below-frontier block in flight that no active batch
/// accounts for.
pub(super) fn has_in_flight(&self) -> bool {
!self.blocks_remaining.is_empty()
}

/// Drop all in-flight and processed-record state.
pub(super) fn clear(&mut self) {
self.blocks_remaining.clear();
Expand Down
Loading
Loading