mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-08 12:21:09 +03:00
Fix 33c5a983
This commit is contained in:
parent
33c5a9835a
commit
65d5bd40e3
1 changed files with 5 additions and 5 deletions
|
@ -87,7 +87,11 @@ impl OrphanBlockPool {
|
||||||
let mut heights = height_idx.keys().cloned().collect::<Vec<u64>>();
|
let mut heights = height_idx.keys().cloned().collect::<Vec<u64>>();
|
||||||
heights.sort_unstable();
|
heights.sort_unstable();
|
||||||
for h in heights.iter().rev() {
|
for h in heights.iter().rev() {
|
||||||
let _ = self.remove_by_height_nolock(h);
|
if let Some(hs) = height_idx.remove(h) {
|
||||||
|
for h in hs {
|
||||||
|
let _ = orphans.remove(&h);
|
||||||
|
}
|
||||||
|
}
|
||||||
if orphans.len() < MAX_ORPHAN_SIZE {
|
if orphans.len() < MAX_ORPHAN_SIZE {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -102,10 +106,6 @@ impl OrphanBlockPool {
|
||||||
fn remove_by_height(&self, height: &u64) -> Option<Vec<Orphan>> {
|
fn remove_by_height(&self, height: &u64) -> Option<Vec<Orphan>> {
|
||||||
let mut orphans = self.orphans.write().unwrap();
|
let mut orphans = self.orphans.write().unwrap();
|
||||||
let mut height_idx = self.height_idx.write().unwrap();
|
let mut height_idx = self.height_idx.write().unwrap();
|
||||||
self.remove_by_height_nolock(height)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn remove_by_height_nolock(&self, height: &u64) -> Option<Vec<Orphan>> {
|
|
||||||
height_idx
|
height_idx
|
||||||
.remove(height)
|
.remove(height)
|
||||||
.map(|hs| hs.iter().filter_map(|h| orphans.remove(h)).collect())
|
.map(|hs| hs.iter().filter_map(|h| orphans.remove(h)).collect())
|
||||||
|
|
Loading…
Reference in a new issue