Skip to content

Commit f66dd6b

Browse files
committed
fix: early return
1 parent 12fbf11 commit f66dd6b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ impl StacksBlockPool {
170170
// Look for the orphan block in the blocks DB. If it already exists, it means we've received an old block and we
171171
// should just ignore it. This can happen if the Stacks node feeding us blocks is still catching up to our chain
172172
// tip.
173-
let handled = if let Some(db_access) = &self.database_access {
173+
if let Some(db_access) = &self.database_access {
174174
if let Ok(true) = db_access.block_exists(&block.block_identifier, ctx) {
175175
try_info!(
176176
ctx,
177177
"Ignoring previously processed block: Stacks {}",
178178
block.block_identifier
179179
);
180-
true
180+
return Ok(None);
181181
} else {
182182
// Check the new block's parent, perhaps this is a deep re-orged block segment we need to add to our
183183
// forks.
@@ -192,15 +192,16 @@ impl StacksBlockPool {
192192
let mut fork = ChainSegment::new();
193193
fork.append_block_identifier(&block.parent_block_identifier);
194194
self.add_fork(fork);
195-
true
196195
} else {
197-
false
196+
try_error!(
197+
ctx,
198+
"Unable to process deep re-orged fork block: Stacks {}",
199+
block.block_identifier
200+
);
201+
return Err("Unable to process deep re-orged fork Stacks block".to_string());
198202
}
199203
}
200204
} else {
201-
false
202-
};
203-
if !handled {
204205
try_error!(
205206
ctx,
206207
"Unable to process orphan block: Stacks {}",

0 commit comments

Comments
 (0)