Skip to content
Merged
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
2 changes: 2 additions & 0 deletions core/src/verification/queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ impl<K: Kind> VerificationQueue<K> {
*td -= score;
}
}
processing.shrink_to_fit();
processing.is_empty()
}

Expand Down Expand Up @@ -444,6 +445,7 @@ impl<K: Kind> VerificationQueue<K> {
new_verified.push_back(output);
}
}
processing.shrink_to_fit();

self.verification.sizes.verified.fetch_sub(removed_size, AtomicOrdering::SeqCst);
*verified = new_verified;
Expand Down
7 changes: 7 additions & 0 deletions sync/src/block/downloader/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ impl BodyDownloader {
self.downloaded.insert(hash, body);
}
}
self.downloading.shrink_to_fit();
}

pub fn add_target(&mut self, header: &Header, parent: &Header) {
Expand All @@ -93,13 +94,17 @@ impl BodyDownloader {
self.downloading.remove(hash);
self.downloaded.remove(hash);
}
self.targets.shrink_to_fit();
self.downloading.shrink_to_fit();
self.downloaded.shrink_to_fit();
}

pub fn reset_downloading(&mut self, hashes: &[H256]) {
cdebug!(SYNC, "Remove downloading by timeout {:?}", hashes);
for hash in hashes {
self.downloading.remove(&hash);
}
self.downloading.shrink_to_fit();
}

pub fn drain(&mut self) -> Vec<(H256, Vec<UnverifiedTransaction>)> {
Expand All @@ -111,7 +116,9 @@ impl BodyDownloader {
break
}
}
self.downloaded.shrink_to_fit();
self.targets.drain(0..result.len());
self.targets.shrink_to_fit();
result
}
}
2 changes: 2 additions & 0 deletions sync/src/block/downloader/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ impl HeaderDownloader {
}
}
}
self.queued.shrink_to_fit();
}

pub fn mark_as_queued(&mut self, hashes: Vec<H256>) {
Expand All @@ -195,5 +196,6 @@ impl HeaderDownloader {
self.queued.insert(hash, header);
}
}
self.downloaded.shrink_to_fit();
}
}