mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 11:31:08 +03:00
fix: panic at get_locator (#1711)
This commit is contained in:
parent
0a96949fd6
commit
009baa1b91
1 changed files with 10 additions and 9 deletions
|
@ -240,8 +240,8 @@ impl HeaderSync {
|
||||||
let shrink_index = self
|
let shrink_index = self
|
||||||
.history_locators
|
.history_locators
|
||||||
.iter()
|
.iter()
|
||||||
.position(|&r| r.0 > shrink_height)
|
.position(|&r| r.0 > shrink_height);
|
||||||
.unwrap();
|
if let Some(shrink_index) = shrink_index {
|
||||||
if shrink_index > 100 {
|
if shrink_index > 100 {
|
||||||
// shrink but avoid trivial shrinking
|
// shrink but avoid trivial shrinking
|
||||||
let mut shrunk = self.history_locators[shrink_index..].to_vec();
|
let mut shrunk = self.history_locators[shrink_index..].to_vec();
|
||||||
|
@ -250,6 +250,7 @@ impl HeaderSync {
|
||||||
self.history_locators.push((0, locator[locator.len() - 1]));
|
self.history_locators.push((0, locator[locator.len() - 1]));
|
||||||
self.history_locators.append(&mut shrunk);
|
self.history_locators.append(&mut shrunk);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
debug!(
|
debug!(
|
||||||
LOGGER,
|
LOGGER,
|
||||||
"sync: history locators: len={}, shrunk={}",
|
"sync: history locators: len={}, shrunk={}",
|
||||||
|
|
Loading…
Reference in a new issue