Skip to content

Commit

Permalink
test: introduce vector 52
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludo Galabru authored and MicaiahReid committed Aug 3, 2023
1 parent 5154885 commit 8ed4b44
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/chainhook-sdk/src/indexer/stacks/blocks_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,16 @@ impl StacksBlockPool {
microblocks: Vec<StacksMicroblockData>,
ctx: &Context,
) -> Result<Option<StacksChainEvent>, String> {
if self.block_store.is_empty() {
ctx.try_log(|logger| {
slog::info!(
logger,
"Ignoring microblock trail, fork tracking will start with the next anchor block"
)
});
return Ok(None);
}

ctx.try_log(|logger| {
slog::info!(logger, "Start processing {} microblocks", microblocks.len())
});
Expand Down
5 changes: 5 additions & 0 deletions components/chainhook-sdk/src/indexer/stacks/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,8 @@ fn test_stacks_vector_050() {
fn test_stacks_vector_051() {
process_stacks_blocks_and_check_expectations(helpers::stacks_shapes::get_vector_051());
}

#[test]
fn test_stacks_vector_052() {
process_stacks_blocks_and_check_expectations(helpers::stacks_shapes::get_vector_052());
}
Original file line number Diff line number Diff line change
Expand Up @@ -3717,3 +3717,25 @@ pub fn get_vector_051() -> Vec<(BlockEvent, StacksChainEventExpectation)> {
),
]
}

/// Vector 052: Generate the following blocks
///
/// [a1](1) - [b1](2) - B1(3)
///
///
pub fn get_vector_052() -> Vec<(BlockEvent, StacksChainEventExpectation)> {
vec![
(
microblocks::a1(stacks_blocks::A1(None), None),
expect_no_chain_update(),
),
(
microblocks::b1(stacks_blocks::A1(None), None),
expect_no_chain_update(),
),
(
stacks_blocks::B1(None),
expect_chain_updated_with_block(stacks_blocks::B1(None), vec![]),
),
]
}

0 comments on commit 8ed4b44

Please sign in to comment.