Skip to content

Commit

Permalink
fix: tests::neon_integrations::bitcoind_forking_test
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Jul 16, 2021
1 parent 37eaa02 commit 9742299
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/burnchains/burnchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,25 +1170,26 @@ impl Burnchain {
let db_height = burn_chain_tip.block_height;

// handle reorgs
let (mut sync_height, did_reorg) = Burnchain::sync_reorg(indexer)?;
if did_reorg {
let (sync_height, did_reorg) = Burnchain::sync_reorg(indexer)?;
let end_height = if did_reorg {
// a reorg happened
warn!(
"Dropping headers higher than {} due to burnchain reorg",
sync_height
);
indexer.drop_headers(sync_height)?;
// Patch issue #2771
if let Some(target_block_height) = target_block_height_opt {
sync_height = target_block_height;
}
}
target_block_height_opt
} else {
None
};

let mut end_block = indexer.sync_headers(sync_height, end_height)?;

// get latest headers.
debug!("Sync headers from {}", sync_height);

// fetch all headers, no matter what
let mut end_block = indexer.sync_headers(sync_height, None)?;
let mut start_block = sync_height;
if db_height < start_block {
start_block = db_height;
Expand Down

0 comments on commit 9742299

Please sign in to comment.