Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.

Commit be0c2c0

Browse files
authored
fix: always append block 0 (#728)
1 parent 48880d1 commit be0c2c0

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

components/chainhook-sdk/src/indexer/stacks/blocks_pool.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ use crate::{
22
indexer::{
33
database::BlocksDatabaseAccess, fork_scratch_pad::CONFIRMED_SEGMENT_MINIMUM_LENGTH,
44
ChainSegment, ChainSegmentIncompatibility,
5-
}, try_error, try_info, utils::Context
5+
},
6+
try_error, try_info,
7+
utils::Context,
68
};
79
use chainhook_types::{
810
BlockIdentifier, StacksBlockData, StacksBlockUpdate, StacksChainEvent,
@@ -191,6 +193,13 @@ impl StacksBlockPool {
191193
self.block_store
192194
.insert(block.block_identifier.clone(), block.clone());
193195
self.add_fork(fork);
196+
} else if block.block_identifier.index == 0 {
197+
try_info!(
198+
ctx,
199+
"Appending block 0 special case: Stacks {}",
200+
block.block_identifier
201+
);
202+
return Ok(None);
194203
} else {
195204
try_error!(
196205
ctx,
@@ -252,7 +261,10 @@ impl StacksBlockPool {
252261
// Generate chain event from the previous and current canonical forks
253262
self.canonical_fork_id = canonical_fork_id;
254263
let canonical_fork = self.forks.get(&canonical_fork_id).unwrap().clone();
255-
try_info!(ctx, "Canonical fork is: {canonical_fork_id} {canonical_fork}");
264+
try_info!(
265+
ctx,
266+
"Canonical fork is: {canonical_fork_id} {canonical_fork}"
267+
);
256268
if canonical_fork.eq(&previous_canonical_fork) {
257269
try_info!(ctx, "Canonical fork unchanged");
258270
return Ok(None);

0 commit comments

Comments
 (0)