Skip to content

Commit

Permalink
chore: error log rather than panic workaround for unexpected non_cons…
Browse files Browse the repository at this point in the history
…ensus_event predicate
  • Loading branch information
zone117x committed Oct 24, 2024
1 parent a40ff87 commit 53e1ced
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/chainhook-sdk/src/chainhooks/stacks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ pub fn evaluate_stacks_predicate_on_block<'a>(
pub fn evaluate_stacks_predicate_on_non_consensus_events<'a>(
events: &'a Vec<StacksNonConsensusEventData>,
chainhook: &'a StacksChainhookInstance,
_ctx: &Context,
ctx: &Context,
) -> (
Vec<&'a StacksNonConsensusEventData>,
BTreeMap<&'a str, &'a BlockIdentifier>,
Expand All @@ -873,7 +873,11 @@ pub fn evaluate_stacks_predicate_on_non_consensus_events<'a>(
| StacksPredicate::NftEvent(_)
| StacksPredicate::StxEvent(_)
| StacksPredicate::PrintEvent(_)
| StacksPredicate::Txid(_) => unreachable!(),
| StacksPredicate::Txid(_) => {
ctx.try_log(|logger| {
slog::error!(logger, "Invalid predicate for non-consensus events: {:?}", chainhook.predicate)
});
},
};
}
(occurrences, expired_predicates)
Expand Down

0 comments on commit 53e1ced

Please sign in to comment.