1
0
Fork 0
mirror of https://github.com/romanz/electrs.git synced 2025-02-23 14:50:45 +01:00

Allow --reindex-last-blocks to be larger than height

This commit is contained in:
Roman Zeyde 2021-10-11 13:17:20 +03:00
parent 2d2544f502
commit f288fd2116

View file

@ -58,12 +58,11 @@ impl Chain {
if n == 0 {
return;
}
if let Some(new_height) = self.height().checked_sub(n) {
self.update(vec![NewHeader::from((
self.headers[new_height].1,
new_height,
))])
}
let new_height = self.height().saturating_sub(n);
self.update(vec![NewHeader::from((
self.headers[new_height].1,
new_height,
))])
}
/// Load the chain from a collecion of headers, up to the given tip