fix off by one in setup_height (#988)

This commit is contained in:
Antioch Peverell 2018-04-20 21:11:41 -04:00 committed by GitHub
parent f0cf903adc
commit c36e72d8c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,7 +236,7 @@ impl ChainStore for ChainKVStore {
fn setup_height(&self, header: &BlockHeader, old_tip: &Tip) -> Result<(), Error> { fn setup_height(&self, header: &BlockHeader, old_tip: &Tip) -> Result<(), Error> {
// remove headers ahead if we backtracked // remove headers ahead if we backtracked
for n in header.height..old_tip.height { for n in header.height..old_tip.height {
self.delete_header_by_height(n)?; self.delete_header_by_height(n + 1)?;
} }
self.build_by_height_index(header, false) self.build_by_height_index(header, false)
} }