mirror of
https://github.com/romanz/electrs.git
synced 2025-02-23 22:56:55 +01:00
Allow --reindex-last-blocks to be larger than height
This commit is contained in:
parent
2d2544f502
commit
f288fd2116
1 changed files with 5 additions and 6 deletions
|
@ -58,13 +58,12 @@ impl Chain {
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let Some(new_height) = self.height().checked_sub(n) {
|
let new_height = self.height().saturating_sub(n);
|
||||||
self.update(vec![NewHeader::from((
|
self.update(vec![NewHeader::from((
|
||||||
self.headers[new_height].1,
|
self.headers[new_height].1,
|
||||||
new_height,
|
new_height,
|
||||||
))])
|
))])
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Load the chain from a collecion of headers, up to the given tip
|
/// Load the chain from a collecion of headers, up to the given tip
|
||||||
pub(crate) fn load(&mut self, headers: Vec<BlockHeader>, tip: BlockHash) {
|
pub(crate) fn load(&mut self, headers: Vec<BlockHeader>, tip: BlockHash) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue