-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Update Chain Reorg Detection and Handling #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ore emitting live
This reverts commit 9a63182.
This reverts commit 8169ed7.
This reverts commit 13bd108.
| use tracing::{debug, error, info, warn}; | ||
|
|
||
| #[allow(clippy::too_many_arguments)] | ||
| pub(crate) async fn stream_live_blocks<N: Network>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the amount of changes to the block_range_scanner.rs, it was becoming hard to understand the implication of those changes.
I figured it would be a good time to extract these common functions and to refactor handle_sync for two reasons:
- Easier to review -
stream_live_blocksandstream_historical_blocksbehave completely differently from before, and can be regarded as completely new functions. Moving them to common.rs makes the reviewer look at these functions for what they are - new functions. - Show what the future
BlockRangeScannerrefactor could look like (see sync_handler.rs) - each mode would be its own "strategy" type.
| let sync_handler = SyncHandler::new( | ||
| self.provider.clone(), | ||
| self.max_block_range, | ||
| start_id, | ||
| block_confirmations, | ||
| sender, | ||
| ); | ||
| sync_handler.run().await |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a strategy-like pattern that we could use for mode handling. The logic is all contained within the strategy type.
Resolves #56
Resolves #76
Resolves #5
Resolves #155