Skip to content

Commit

Permalink
Merge pull request #116 from propeller-heads/dc/skip-state-decode-fai…
Browse files Browse the repository at this point in the history
…lures

feat: Allow for skip_state_decode_failures in TychoStreamDecoder to be set
  • Loading branch information
dianacarvalho1 authored Dec 20, 2024
2 parents 95257d4 + 6364959 commit 7f2ad91
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/evm/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ impl TychoStreamDecoder {
guard.tokens = tokens;
}

pub fn skip_state_decode_failures(&mut self, skip: bool) {
self.skip_state_decode_failures = skip;
}

/// Registers a decoder for a given exchange.
///
/// This method maps an exchange identifier to a specific protocol simulation type.
Expand Down
8 changes: 8 additions & 0 deletions src/evm/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ impl ProtocolStreamBuilder {
self
}

/// Skips state decode failures, allowing the stream to continue processing. It raises a warning
/// instead of panic.
pub fn skip_state_decode_failures(mut self, skip: bool) -> Self {
self.decoder
.skip_state_decode_failures(skip);
self
}

pub async fn build(
self,
) -> Result<impl Stream<Item = Result<BlockUpdate, StreamDecodeError>>, StreamError> {
Expand Down

0 comments on commit 7f2ad91

Please sign in to comment.