Skip to content

Commit

Permalink
Merge pull request #2310 from CounterpartyXCP/wp/rust-fetcher-fix-reo…
Browse files Browse the repository at this point in the history
…rg-logic

Rust fetcher reorg logic fix
  • Loading branch information
adamkrellenstein authored Oct 5, 2024
2 parents 927cb63 + c68c265 commit 4a3667a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion counterparty-rs/src/indexer/workers/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ where
pub fn new<C, D, B>(
client: C,
db: D,
start_height: u32,
initial_height: u32,
reorg_window: u32,
) -> impl Fn(
Receiver<Box<PipelineDataInitial>>,
Expand All @@ -70,6 +70,7 @@ where
B: BlockHasPrevBlockHash,
{
move |_, tx, stopper| {
let mut start_height = initial_height;
let mut height = start_height;
let mut target_height = if height > 0 { height - 1 } else { 0 };
let mut reorg_detection_enabled = false;
Expand Down Expand Up @@ -111,6 +112,7 @@ where

db.write_batch(|batch| db.rollback_to_height(batch, last_matching_height))?;
height = last_matching_height + 1;
start_height = height;
target_height = height - 1;
reorg_detection_enabled = false;
continue;
Expand Down

0 comments on commit 4a3667a

Please sign in to comment.